- Home /
How to change from Y axis to Z axis, transform.LookAt
In the docs its stated that the default axis that the GameObject will point at the target along the Y axis. How can I change this to be the Z axis using a Vector3? The docs lack any examples on the matter.
Comment
Best Answer
Answer by cod · Sep 11, 2013 at 03:11 PM
here's the doc link text
u just have to use
transform.LookAt(target, Vector3.forward);
PS a quick tip
back Shorthand for writing Vector3(0, 0 ,-1).
down Shorthand for writing Vector3(0, -1, 0).
forward Shorthand for writing Vector3(0, 0 , 1).
left Shorthand for writing Vector3(-1, 0, 0).
one Shorthand for writing Vector3(1, 1, 1).
right Shorthand for writing Vector3(1, 0, 0).
up Shorthand for writing Vector3(0, 1, 0).
zero Shorthand for writing Vector3(0, 0, 0).