Hello,
I have the following problem. An object A is designed to sent a command to the fist item it collides with and then destroy its self. If the colliders of two objects B and C are one over the other the object A send the command to both.
Example code:
function OnTriggerEnter (victim : Collider)
{
//SendMessage to victim;
Destroy(gameObject);
}
I assumed that after the fist collision with object B was detected and the message sent object A would be destroyed and collision with object C will not be detected. Unfortunatly this is not the case.
Is there any way to get it to work as i want it?
Update:
I managed to find the solution. I created a Boolean variable that gets triggered the first time OntriggerEnter activates and blocks additional activations:
function OnTriggerEnter (victim : Collider)
{
If (!triggered)
{
//SendMessage to victim;
Destroy(gameObject);
triggered=true;
}
}