- Home /
Vector3 sets to different coordinates than specified
This is probably a dumb question and I'm just overlooking something simple but I can't figure out what for the life of me.
I have a code where I am setting a bunch of Vector3s and I am using it to change the position of cameras and other objects as so:
Vector3 CAMERA = new Vector3 (2.661137f, 2.023687f, 0.9875622f);
legcamera.transform.position = CAMERA;
However when I run it in my editor, the camera currently goes to -0.4207597, -4.785051, 4.535485 This occurs for any object I try transforming via the above method so it's not due to me setting values elsewhere. Most of the objects I am trying are children objects if that makes any difference (which from reading I came to the conclusion that it did not)
Any help is appreciated!
Answer by Sisso · Jul 14, 2014 at 06:41 PM
Transform.position set/get position in world coordinates. What you see in inspector is in local coordinades (relative to parent(s))
http://docs.unity3d.com/ScriptReference/Transform-position.html
http://docs.unity3d.com/ScriptReference/Transform-localPosition.html
Thank you! I knew it was something simple that I was missing. Now it works