How to respawn in Roll A Ball? How to do collision?

For my project I have to do the following:

  • Define an invisible plane below the floor that if the ball touches it (by falling off the plane/maze floor), then the player is returned to the start position
  • Include “enemies” that oscillate back and forth in a small part of the maze; if the ball collides with an “enemy,” then the game ends

How do I this? I am a total beginner. I would appreciate maybe a tutorial video that shows me help or a step by step on the coding. Thanks!

This is really basic, I guess you didn’t check any Unity Tutorial or Manual neither did you search for any Youtube Videos.

The plane should get a Collider with Trigger enabled. And a simple script:

class DeathPlane
{
void OnTriggerEnter(Collider coll)
{
coll.gameobject.getComponent(PlayerScript).Kill();
}
}

the enemys are the same except they are not triggers, and should get a slightly different script:

class Enemy
{
void OnCollisionEnter(Collision coll)
{
coll.gameObject.getComponent(PlayerScript).Kill();
}
}

Then on your playerScript add a public void Killl() method that respawns the player to a specific position : transform.position = spawnposition (define it);

This is for the killing part, the movement is more complicated but if you did the roll a ball tutorial you should manage !