Question by
tuliopereiramaia · May 23, 2018 at 02:54 AM ·
collisiontransform.positioncheckpoint
Checkpoint after fall on a plane
Hi! I'm creating a simple game on Unity and trying to implement a checkpoint/respawn system.
The idea is that if the player fall from a specific plane, he will hit a invisible plane and then trigger a collision event, that will move its position to the respawn one.
I've developed the following code for the collider:
public class LimiteController : MonoBehaviour {
public Transform respawnPosition;
public GameObject Jogador;
void Start()
{
respawnPosition.position = GameObject.FindGameObjectWithTag("Respawn").transform.position;
}
void OnTriggerEnter (Collider other)
{
if (other.gameObject.tag == "Limite")
{
Jogador.transform.position = respawnPosition.position;
}
}
}
I've also attached a Mesh collider and a Rigid body to the limit plane, but still I can't get it to work, someone can help me?
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220612163236im_/https://answers.unity.com/themes/thub/images/avi.jpg)