Hi all,
In my game I am adding force to a rigidbody based on the distance of the rigidbody to the floor. The problem is, when I access “transform.position” in code, it returns a vector3 where the X,Y,Z is only 1 decimal place.
For example, from Debug.Log:
(0.1, -0.8, -11.0)
This causes me a problem because the force is then very inaccurate. It’s too powerful and my object ends up pushed below the desired height, and so more force is added to compensate, but this force is also too much, and so my object bobs along continuously.
If I look in the inspector, the transform’s position X,Y,Z show 7 decimal places which is far more accurate.
Is there a reason transform.position is returning 1 decimal, and how can I get more accuracy from it?
Thanks for your help.
Mat