x


Trigger respawn after collision?

So I am working on this diving game prototype that I posted about earlier, and I am a complete 'tard when it comes to scripting so I therefore need some help with this one.

I need the make the player respawn back on top at the diving board a couple of seconds after hitting the water.

I tried to look at the Lerpz 3D tutorial, but can't seem to figure out how to make it work in my own project. Any clues on how to do this?

What I think I understand by now is that I should create a collision object in the water that makes the player respawn at a selectet position (spawnpoint) after hitting it.

more ▼

asked Jul 12 '10 at 08:31 AM

remvan3d gravatar image

remvan3d
49 8 8 14

(comments are locked)
10|3000 characters needed characters left

3 answers: sort voted first

You can attach something like this to your water, though you'll have to make sure the player has a rigidbody and collider, and the water has a trigger collider:

var spawn : Transform; //drag your spawn point to here in the inspector - probably make it an empty gameobject so you can move it about on the diving board

function OnTriggerEnter(other : Collider)
{
    if (cother.tag == "Player")
    {
        other.transform.position = spawn.position;
    }
}
more ▼

answered Jul 12 '10 at 09:51 AM

Mike 3 gravatar image

Mike 3
30.6k 10 67 254

(comments are locked)
10|3000 characters needed characters left

Fantastic :)) Works great man :) Thank you !!

more ▼

answered Oct 06 '12 at 05:03 PM

munaeem gravatar image

munaeem
98 1 5 9

(comments are locked)
10|3000 characters needed characters left

can I use this with my game

more ▼

answered Dec 21 '12 at 12:52 AM

Player4 gravatar image

Player4
1

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3416
x2582
x1015
x186
x133

asked: Jul 12 '10 at 08:31 AM

Seen: 2688 times

Last Updated: Dec 21 '12 at 12:52 AM