Car Game For School Project

So I’m making a car game with my friends for a school project, and if you want and or need to respawn I was thinking of doing so that when you press “K” you respawn at wanted location and in the right direction. I’ve gotten the position right so that it should spawn where I wanted, but I can’t get the direction script to work. So my question is, where am i going wrong with the rotation lines and as I’m using “this”, will do the things to the car if I attatch the script to it. I’m using the public variables so that I can edit them easily w/o opening mono. I’m no pro so don’t judge please :slight_smile:

public class BilKeyRespawn : MonoBehaviour {

public float x;
public float y;
public float z;
public float a;
public float b;
public float c;
void Update() {
	if (Input.GetKeyDown (KeyCode.K))

		this.transform.position = new Vector3 (x,y,z);
		this.transform.rotate = new Vector3 (a,b,c);
	
}

}

Best would be to have empty game objects at spawn point. This way you can orientate them as you need and use that rotation.

This will not compile. You are probably getting some errors in the console.

transform.Rotate is a function and not a variable, so you can not set it to be a Vector3.

transform.rotation is a variable of type Quaternion so you can not set that to a Vector3 either.

You are probably looking for transform.eulerAngles which is the Vector3 rotation of the GameObject:

this.transform.eulerAngles = new Vector3 (a,b,c);