Add Vector3 on local axis
Hello I'm using this code to move my object back a bit every frame
myObject.transform.localPosition -= new Vector3 (0,0,ammountToTakeOff); I rotate "myObject" on the Y 90 degrees when I press D and -90 degrees when I press A. But when I rotate my object It moves backwards on the world Z axis, I want it to move backwards on it's Local Z axis. Thanks :)
Answer by IAMBATMAN · Jun 12, 2016 at 01:21 AM
LOL Found the solution right after posting face plams, anyway for those of you who want to know I used this
myObject.transform.Translate (-myObject.forward * ammountToTakeOff,Space.World);
Your answer
Follow this Question
Related Questions
Helicopter Move Local Position,Local Position 1 Answer
Rotate LOCAL y axis to match Joystick input 0 Answers
Help with raycast for for wall detection 1 Answer
How to rotate the player towards a Vector2? 1 Answer
I want to make a script that causes the directional light to stop at 180 degrees. 0 Answers