I have a rather simple collision problem, but I can't get it working. I have read the manual about physics and all the answers in here about collisions and detection, but for me it doesn't work.
I have the following scenario (simple Space-Invaders-Clone). One Prefab (Enemy) with an attached Script, that handles the "OnTriggerEnter"-Event. A box-collider attached to this object with "Trigger" checked. Another Prefab (Bullet) also has an Script attached and a box-collider. Both Objects are moving and should collide, but the event doesn't get called (I have a debug.log-call inside the method).
I'm still confused if I have to use a rigid-body for this kind of simple collision detection, I absolutely don't want any physics simulation. Plus I don't know if the collision-box moves with the gameobject (it should, because it is a child of it, I think).
I'm really not a novice programmer, but new to unity. Am I missing something simple or is it really a hassle to get simple collisions?
Please don't refere to the documentation or specification, I read them already twice :).
Other solutions to this problem are welcome.
asked Feb 22 '10 at 06:00 PM
In order for 2 colliders to collide one of the colliders must have a rigid body assigned. You can tweak the settings on this rigidbody so it does not effect the gameObject by turning off gravity etc... but in order for the collision event to happen one of your bodies needs a rigidBody.
answered Feb 22 '10 at 06:20 PM
As stated in Collider.isTrigger:
So the Rigidbody needs to be on the object that is not a trigger. From your description, it sounds like you either didn't use Rigidbodies at all, or that you maybe only had the Rigidbody on the collider that has isTrigger set (which would not work).
answered Feb 23 '10 at 09:51 AM