- Home /
How do I make something happen at collider
Hi I've made an ball game and I added a circular saw that will be used as a trap but I can't figure out how to make my ball (player) respawn when it touches the saw and I can't use trigger since Im already using it for something else (I've already made an respawn script that teleports me to the spawn)
Comment
could I please get an js example it would be realy helpfull :)
Best Answer
Answer by robertbu · May 30, 2013 at 07:00 PM
You can use your same trigger, just add a condition inside the trigger that either 1) detects the different objects, 2) detects the different conditions.
function OnTriggerEnter (other : Collider) {
if (other.collider.tag == "Enemy") {
Destroy(other.gameObject);
}
else if (other.collider.name == "Player") {
other.collider.transform.position = Vector3(1,1,0);
}
}
Your answer
Follow this Question
Related Questions
Multiple Colliders Trigger problem 2 Answers
Tipping a cube over 2 Answers
Internal collisions 1 Answer