- Home /
Question by
Zoltantan · Mar 04, 2013 at 12:32 PM ·
movepositioning
End position is not accurate when using lerp.
I am using lerp to move a gameobject on button press. And the problem: Assume start position is (0,0,0) and end position is (0,0,10) The object moves smoothly as intended but it won't reach the end position, only (0,0,0.99999).
Comment
Best Answer
Answer by Jeffom · Mar 04, 2013 at 12:37 PM
That's because the step value is too high, you should set a threshold in your update funciona something like
if( myPositionValue >= 99989 )
myPositionValue = 99999;
set the position and stop the lerp,