Setting .localposition is unacurrate

Hey Guys,

I have a problem here. I move my character and I have the condition that while my character’s position is different that the position that i want him to go (a float), then keep moving. I used to use transform.position and it was always working fine, but now I change the hierarchy of my project and I must use .localposition and I have a problem. there is a line where I set my localposition to for example (3200,0,0) and it turns out that the x coordinate is not really 3200, it is like 3199.98 or 3200.024 even if i clearly set it to 3200. I never encoutered this issue with the transform.position. Does anybody has an idea ?

Thanks a lot for your time.


My guess is that you were just lucky with .position working and that you would have gotten the same problem eventually.

When comparing float positions it is better to use approximation and check how close a position is to the target position.