GameObject moving forward depending on its orientation?

Hello everyone.

I’d like to know how I could make a gameObject moving forward its orientation. In fact, I’d like to invert the quaternion from time to time. So if the movement depends on the orientation I’ll only have to play with Quarternion to change the movement direction instead of playing with x,y and z.

Thanks in advance

Sounds like you want transform.forward.

Vectors are the most usefull tool for this kind of trouble. And unity use them in a friendly way, so you can copy a character controller script and modify it. The default char controller you can find in standard assets moves your char using absolute coordinates, i mean when you press “left arrow” on your keyboard it will move towards left of your screen. To modify this you must change to rotation when pressing left and right arrow keys and to move forward when you press up arrow, for instance. To do this you must use the Vector3 your char has in every moment, for rotation and for advancing, instead of using absolute coordinates (screen).