GTA3 floating point math increments at 0.0625 at a time #224
Replies: 5 comments
-
I tried to decompile the .cs file and sure enough, its different
|
Beta Was this translation helpful? Give feedback.
-
This is how floats work in GTA III. |
Beta Was this translation helpful? Give feedback.
-
Interesting, I'll have to figure out other ways around that then. Thanks! |
Beta Was this translation helpful? Give feedback.
-
This limitation only affects floating-point literals. You can't use 0@ = 0.3 because the compiler truncates the value to 0.25. But you can bypass it by writing an IIIE-754 representation of the float into a variable (they are 32-bit and contain values as is).
let me know if that works. |
Beta Was this translation helpful? Give feedback.
-
Yes, that works. Interesting too because it can do floating point math fine. I just had to adapt it to look like this and it works fine
|
Beta Was this translation helpful? Give feedback.
-
This is a really weird issue. I was debugging why some code wasn't working and made this simple counter CLEO script
One would expect it to go up like
[0.1, 0.2, 0.3, 0.4, 0.5]
But instead, it goes up like
[0.0625, 0.1250, 0.1875, 0.25, 0.3125]
Adding different values like between 0.0-0.6 causes 0@ to not change,
while adding something like 0.2 causes it to go more like
[0.1875, 0.3125, 0.5625]
, as if it was rounding to the nearest floating point divisible by 0.625. I'm not sure if this is a Sanny Builder thing or GTA3 thing, but it does work as expected for VC and SA.Setting values like
0@ = 0.3
does the same thing as well, where this rounds down to 0.25Beta Was this translation helpful? Give feedback.
All reactions