How to ignore rotation while moving?

Hello, I’m very noob at programming but I wanted to try something using some tutorials.

I basically have an object and using Android’s accelerometer it rotates, then by using two buttons, it either goes left or right. For this I use transform.Rotate (0, 0, -temp * Time.deltaTime); and transform.Translate (speed * Time.deltaTime, 0, 0);

The program works properly and once the object has rotated, it moves in the “new x axis”, but I want it to move in the “world’s x axis”, one thats “permanent”.

As I’m very bad at programming and english as well I made a simple drawing so its easier to understand what do I want to do:

Being the upper case what happens (and should happen as it has been programmed) and the other what I want to achieve. Any suggestions on how to do this and “ignore” the rotation of the object?

Thanks for your time :smiley:

You can find the answer here:

I know this post is older, I just saw this and found this to work:

transform.Rotate (0, 0, -temp * Time.deltaTime);

and then do this:

transform.position += new Vector3(speed * Time.deltaTime, 0f, 0f);

Adjust your speed variable accordingly.