I have a simple ball bouncing game where I would like a ball to make contact with multiple different triggers. One trigger causes the ball to slow down, another causes a lose state that repeats the level. The problem I am having is that I can’t figure out how to differentiate the triggers from one another.
I have the OnTriggerEnter attached to the ball but don’t know how to tell it which trigger it has entered. Right now I am limited to having only one trigger in the scene because of this.
//Fail Condition Takes you to fail screen and plays particle explosion
var Ball_Explodes : GameObject;
var Explosion_01 : AudioClip;
function OnTriggerEnter (Ball_01 : Collider) {
rigidbody.velocity = Vector3(0,0,0); //Stops ball movement
Instantiate(Ball_Explodes, transform.position, Quaternion.Euler(-90, 0, 0)); //Particle explosion
audio.PlayOneShot(Explosion_01, 0.7); //Plays explosion
NextLevel(); //Runs next level function
]