Respawn Rotation

Hi,

I have a car in my game. When you press the “r” key, the car respawns. When it respawns, however, it is facing the wrong direction. Here is the code:

function Update () {

if (Input.GetKeyDown(KeyCode.R)){

gameObject.transform.position.x = 709.7604;

gameObject.transform.position.y = 32.7501;

gameObject.transform.position.z = 592.1172;

gameObject.transform.rotation.x = 0;

gameObject.transform.rotation.y = 268.46;

gameObject.transform.rotation.z = 0;

}

}

Well…you are setting the rotation of the object manually…so when it respaws…the rotation will be exactly the one you chose ( in that case 268.46)…so all you have to do is to change that number