Need help editing move script

I don’t know much about scripting, so I borrowed a friends movescript for my own project. Unfortunately it’s not quite what I need for my game, as while it’s possible to move the vehicle forward, back, left and right. It isn’t possible to make the vehicle turn.


This is the script in question, so what would I need to change in order to allow the vehicle to turn, like a tank?

You could try the tanks tutorial if you wanted to take code directly.

However, I think you’d gain the most by starting here: https://unity3d.com/learn/beginner-tutorials

Without much detail, you could turn by rotating the object.

It sounds like this Unity tank tutorial could be very useful for you to try out. :slight_smile:

Hi methos5k, sorry I didn’t see your reply until I posted mine. :slight_smile:

lol, np. :slight_smile:

Try to add this to the Update() function :slight_smile:

float direction = 0f;
if (Input.GetKey(KeyCode.LeftArrow))
    direction -= 1f;
if (Input.GetKey(KeyCode.RightArrow))
    direction += 1f;
transform.Rotate(0f, 0f, direction * mySpeed * Time.deltaTime);