Transform constant moving in scene even if translated for Vector3.zero
Hello Guys,
I'm facing a big problem which obviously I cannot solve it by my own. I have a mesh gameObject with components like mesh, meshRenderer and a few materials. The problem comes when I try to move it in Update function. Even if I move it for let say Vector3.zero it Will still slightly move on x axis. I don't know how this is possible but I gues I'm missing something.
So basically my code is:
private void Update() { transform.Translate(Vector3.zero * Time.deltaTime); }
Above sample code Will constantly slightly move by transform by x and z axis and I couldn't realize why.
Thank you for help!!!
Regards, Igor
Answer by tgsoon2002 · Oct 27, 2016 at 01:31 AM
Vector3.zero is 0,0,0 If you want to move in some direction then you need to use Vector3.up or .foward. I think because some translate from one relative to other might add some small value and so your object move little bit on x or z.
Your answer
![](https://koobas.hobune.stream/wayback/20220612064723im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How can I make this translation smoother? 0 Answers
Increase velocity of gameObject every time it spawns? 1 Answer
Y value in transform.Translate when not grounded - gravity problem 0 Answers
How would someone go about creating multiple triggers in one script 0 Answers
Transform.position not working- want to clamp object within confines of screen 0 Answers