Android Top Down Racing Movement Problem

So my intent is to have a top down racing game where the car is moving forward and I steer by rotating the phone.I have the camera rotating when i move the phone and I made the Camera Parent to the PlayerCar so as the camera rotates it steers the car, my question now is how do I make the car constantly move forward in the direction it is pointing so that i just steer it around the track rotating the phone. I started with this from a tutorial but it was in C# and I tried to convert to Java but nothing is happening on launch.

Any ideas how to tackle this?

var moveSpeed = 5;
var movement;

function Awake () {
	movement = moveSpeed;
	movement = Time.deltaTime;
	transform.Translate(0, movement, 0);

I basically just want to do what seems like a simple task, have the car/ball/player/whatever move forward when the game starts but then as the phone rotates, the direction of travel changes with the turning of the phone.

EX: Your holding your phone normally, straight up n down. The player appears in the center and begins moving forward, staying in the center of the screen but the map under him shows that he is moving towards the top of the screen. Now i turn the phone 90 degrees to the right, and the player makes a right turn and starts traveling towards the right side of the screen.

So im thinking having the player center and the camera is a Child to the player, as he moves the camera follows. Any thoughts on any of this would be very helpful, thank you.

If you use something like this transform.Translate(Vector3.forward * moveSpeed); and your camera is indeed parent of your car and the camera will rotate as you rotate your phone, it will always move in the direction the car is facing.

Vector.forward moves the gameobject in its local axis so that will stay the same even if you rotate the object :wink: