I have a 3D game with a object which uses Transform.Translate to move from one side of the scene to the other. Now as im moving this in a FixedUpdate sometime the object doesnt stop on a rounded number e.g. it will stop on X (0.933) when i want to to stop on X(1). I can use iTween etc as im using Physics.
So i thought about using Get and Set Position but how do i round the number and then set the local Vector3 in local space and not world space?
If your transform use a rigidbody, don’t use Transform.translate but Rigidbody.MovePosition.
If you use Transform.translate it will only detect any collision the next frame.
I feel i need to explain in more depth as to how my player object moves. Basically i have a 3D game where the player can move (1) on the local Z axis when they press a button, of course the player doesn’t land on (1) all the time. If the player holds the button down they will keep moving another (1). So what im trying to do is before each iteration/loop in the code i want to make sure the player has not gone too far / or to short to the round number on its local Z axis. So think of it as a grid snap style game but with physics (i can’t move away from physics for this).