- Home /
getting hit and respawning
Hey i need help to create a script in which you get hit by a prefab called " ball " and you respawn back at "respawn point".... please help!
Comment
Best Answer
Answer by Mike 3 · Jul 06, 2010 at 05:52 PM
Something like this should do it:
var spawn : Transform; //assign from the inspector
function OnCollisionEnter(other : Collision) { if (other.name == "ball") { transform.position = spawn.position; transform.rotation = spawn.rotation; } }
Both objects need to be non trigger colliders, and the ball probably needs a non kinematic rigidbody
Hey mike ive tried this and it doesnt work! ive done everything you say but it isnt working for me. please help!
I think $$anonymous$$ike meant OnCollisionEnter, not OnCollisionStart.