Hi i’m pretty new to unity and i’m working on a university project and i’m making a game where you jump onto moving platforms in the sky and i was wondering how i would go about resetting the first person controllers location when you miss the platform because it just free falls, thanks.
Make an empty gameobject and add a box collider to it and resize it (make it very big in x and z) and place it under your level.
Tag this gameobject (let’s say the tag is “Maplimit”).
In your character controller do this:
void OnCollisionEnter(Collision c){
if(c.gameObject.tag == "Maplimit"){
//You can either use a new Vector 3
this.transform.position = new Vector3(0,0,0);
//or have a GameObject and get its position
this.transform.position = mySpawnGameObject.transform.position;
//Where mySpawnGameObject is a public GameObject variable that you assign from the inspector
}
}