Search Unity

True local translation?

Discussion in 'Scripting' started by sheriffcicada, Apr 7, 2011.

  1. sheriffcicada

    sheriffcicada

    Joined:
    Mar 1, 2011
    Posts:
    29
    Hey all-

    I am attempting to move an object relative to its current rotation. So, for instance, if the object is rotated say 180, then the object z positive would be z negative in world space. Or, another example, rotated 90 ... the the object positive z is ... positive x in world space. I thought this would be transform.localPosition, but as it turns out this is relative to the parent, not the objects rotation. Any ideas are welcomed.

    Thanks

    -s
     
  2. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,401
    Use transform.Translate.

    --Eric