I've been having trouble getting colliders and triggers to work with shields. This is for an RTS-style game, and I want projectiles fired from player weapons to pass through shields as if the shield wasn't there, but projectiles fired from enemy weapons to impact the shield.
My projectiles have a simple box collider and a rigidbody (non-kinematic), and my shield has a mesh collider set as a trigger with no rigidbody.
From the table at the bottom of the collider pages in the manual (i.e., http://unity3d.com/support/documentation/Components/class-BoxCollider.html ), it looks like I should be receiving OnTriggerEnter events on the shield when a projectile collides with the shield, but instead, I'm getting an OnCollisionEnter event on the projectile.
I've also tried using a simple sphere collider for the shield, but I get the same result.
How should the colliders be set up so the trigger is called instead of the collider?
asked Dec 21 '10 at 05:27 AM
Maybe you could work this out with link text ?
Or another way, but it sounds weird : When you get an OnCollisionEnter and if this is an ally, set the isTrigger parameter to true. I'm not sure of that approch, but it can't hurt talking about it :)
answered Dec 21 '10 at 09:51 AM