As I was updating my custom camera and movement scripts and I noticed that when I was printing the direction attribute it seemed to print a random decimal number but when I went into debug mode and checked the real value it was something else.
The local variable ‘a’ is there so the debugger doesn’t go out of scope and free the memory of direction before I can see it.
The direction is being added to unit vectors only so it should be showing a unit vector but as you can see when outputting the attribute in anyway it shows a random decimal number.
This works by shifting the number over by 2 decimal places (0.125 would become 12.5 and then when floored would become 12, then divides it by 100 to put it to 0.12; this is basically just creating a fixed decimal precision)
If you want to remove decimals completely just don’t shift the number over.
Honestly I think you may want to do this because in the case of 0.9999999999 you would want to output 1.