- Home /
Transform.right misunderstanding
Hello everybody!
I think there's something abount transform.right that I don't understand at all. The pictures below show 4 objects with the following script attached:
function Update ()
{
this.transform.Translate(-this.transform.right * Time.deltaTime);
}
From this function I would expect them to each move towards their negative local x-axis. In the pictures you can see what they do (top and bottom one move towards global x-axis, left and right one move away from global x-axis).
Why is only one of them moving towards its actual negative local x-axis?
http://docs.unity3d.com/ScriptReference/Transform.html
Check out TransformDirection, TransformPoint and their inverse functions.
Answer by Philip3333 · Jan 31, 2015 at 06:03 PM
I had the same problem and I used Vector3.right instead of tranform.right and it solved the problem, however I would appreciate if you could explain the difference between the two.
Thanks Phil