- Home /
Question by
ProjectCryken · Mar 24, 2014 at 09:53 PM ·
vector3.movetowards
Vector3.MoveTowards, y does not reach target
I am using Vector3.MoveTowards to move an object to a target location. However, y is always slightly off (about 0.1 - 0.5 off). However, the x value always reaches the exact target. How do I fix this? (I don't want to set y manually) Thanks.
Comment
Need to see your code. Vector3.$$anonymous$$oveTowards() will be off slightly, but not by the amounts you are listing.
Answer by Fappp · Mar 24, 2014 at 10:05 PM
var yPos : float = transform.position.y;
function Update(){
Mathf.Round(yPos);
transform.position.y = yPos;
}
Your answer
![](https://koobas.hobune.stream/wayback/20220613141057im_/https://answers.unity.com/themes/thub/images/avi.jpg)