- Home /
transform.position = new Vector 3 NOT moving to correct position?
I'm moving my GameObject via transform.position using this line exactly:
transform.position = new Vector3 (-5.6f, -2.5f, 3f);
Before this line is called, the GameObject is at position (-5.56, -2.35, 3.16).
After I call this line of code, the GameObject is moved to:
Why is is not moving to where transform.position tell it to go? Any help appreciated!
Is this object the child of another object?
You have a scale of 50 on this object, non uniform scale can affect position. Try and keep a uniform scale of (1, 1, 1) throughout. Change your model(object) size in it's import settings not in its transform.
Let us know if this fixes your issue. If not then you need to post your whole script(and any others that interact with this object) as something is probably wrong in one of these.
I have forgot to zero my Empty many times in the past :D Glad you got it sorted!
Answer by Selzier · Dec 07, 2014 at 09:34 PM
Thanks MrSoad! I have found the problem after much confusion! I had created an "Empty" GameObject to put all my Models in for organization purposes. The Empty Gameobject I forgot to reset to 0,0,0, it had a random position like 2.45, 3.4, 0.54. Once I set the empty parent to 0,0,0 everything working as expected. Also fixing scale, working on Ludum Dare so going fast and cutting corners D: