- Home /
Collider should trigger if another comes in
Hey there, I got two objects a bowl and a mixer.
The bowl has a script on it which says:
public Collider mixermarker;
void OnTriggerEnter(Collider other){
if (other == mixermarker) {
Debug.Log("mixermarker inside");
}
}
I dragged the script on the bowl with the collider in it. Then I dragged the mixer (with its own collider) into the line "mixermarker" so that the collider from the mixer is connected to the script.
Now if the mixer collider comes into the bowl collider, there should be "mixermarker inside" in the console. But it isn't.
I tried changing the sizes of the colliders (they do overlap!) and making two new empty game objects with a collider each applied. Nothing works.
Where could be the error? I tried around for about over two hours now..
WTF - since when does the mixermarker object need a Rigidbody to make it work?!?! Did some more experiments in desperation and after adding a rigidbody to the mixer collider it worked... wtf people... wtf .....
Answer by Berenger · Jun 27, 2012 at 04:03 PM
Collision message are sent only when the collision occures because of a physical movement. In other words, Translate won't send the message, gravity or rigidbody.AddForce will.
Answer by olop01 · Jun 27, 2012 at 08:41 PM
Rigid Body did it. Thanks!
That should be mentioned in the script referrence.
"Note that collision events are only sent if one of the colliders also has a non-kinematic rigidbody attached." It's more a hint though. By saying that the rigidbodu mustn't be kinematic, it suppose that it it's moved physically.