Question by
bekocan · Sep 15, 2018 at 06:49 PM ·
rotationtransformvector3transform.positionlocalposition
Helicopter Move Local Position,Local Position
Hi i am making a helicopter game. My helicopter have turn right and left button (Rotate). I have forward button so if i press forward button starting this code:
transform.position += new Vector3 (0,0,1) * Time.deltatime * 5;
But if helicopter rotate another direction and if i press forward button helicopter is moveing global position. I want the helicopter move rotate axis (Move Local Position). Yes my English bad :(
Comment
Answer by tormentoarmagedoom · Sep 17, 2018 at 11:51 AM
Good day.
Then you need to use the transform vectors, which are relative to object rotation:
transform.position += transform.right * Time.deltatime * 5;
(maybe you need the left or forward or another of this vectors, test it)
Bye!