- Home /
Mesh collider from 3d model not triggering collision with plane
I have a plane that represents a 'tar pit' ( y = 0.2 ) that I place on the terrain ( y = 0 ) that I have enemies ( y = 0 ) run over and I want to trigger an event.
I can successfully get other objects ( a cylinder representing a gun tower ) to interact with my enemies, but I can't for the life of me get anything to happen when they cross the plane.
If I move the plane at game time into the enemies, I get the debug statements from both of the OnTriggerEvents ( the enemy and the plane ) , but when the plane is npt moving I can't get any of the functions executing.
Both the enemy and the plane have box colliders with 'Is Trigger' checked, am I missing something ?
Thanks!
Do you need to detect all the time they are touching the plane or only when they cross a certain point?
Answer by aldonaletto · Dec 28, 2011 at 10:06 PM
If the enemies are CharacterControllers, you may place a trigger volume in the tar pit - when an enemy enters the trigger, OnTriggerEnter events will be sent to both, the enemy and the tar pit.
If the enemies aren't CharacterControllers, they must have a rigidbody to be detected by the trigger, and their colliders must not be set as triggers (even because they would fall like rocks through the terrain in this case).
They weren't character controllers.
Adding a rigid body to my enemy fixed the issue, however, I was getting OnTrigger events before between the gun tower ( cylinder that had a rigidbody ) and my enemy ( which did not have a rigid body ).
Wonder why ?
Thanks!
To be detected, collisions or triggers require that at least one of the objects must have a rigidbody or a CharacterController - since the cylinder had the rigidbody, the enemy could be detected.