- Home /
how to convert an objects local axis vector to 'world' vector.
Hi. My cube (which has been rotatated i.e. not aligned with the world axis), has its local x (red) axis pointing towards the right of my screen. I need to somehow have this as a world vector.
Can anyone help, i cant get my head around it.
Daniel
Transform.right will give you the local X axis in world space directly, I believe.
Answer by meat5000 · Oct 18, 2013 at 12:46 AM
TransformPoint and TransformDirection Convert from local to world space.
InverseTransformPoint and InverseTransformDirection do the opposite.
Added from comment :
http://docs.unity3d.com/Documentation/ScriptReference/Transform-right.html
The transform's x axis in world space.
thats great, but do you know how I might get my local 'x' axis vector, in the first place?!?
I guess I do something like...
transform.TransformDirection(myLocalXVector) ....?
http://docs.unity3d.com/Documentation/ScriptReference/Transform-right.html
The transform's x axis in world space.
ah man, thanks very much. I was completely unaware of that one.
No probs :) please accept answer if its what you were looking for.
Your answer
Follow this Question
Related Questions
an ignorant's trigonometry woes: rotate a transform around an axis 2 Answers
Move object relative to its axis 2 Answers
Quaternion.Slerp on local axis 1 Answer
Turn left animation. snaps back 2 Answers
Is there a local method for Rigidbody.constraints? 0 Answers