- Home /
2 small spheres colliding not sending trigger
Unity 3.4
Min Penetration for Penalty = 0
It seems my two spheres won't detect a collision unless they collide directly at the center point of the collider.
The bullet sphere has a scale of 0.25, 0.25, 0.25
The asteroid sphere will only detect collision at the center of the sphere if it's scale is less than 1.5, 1.5, 1.5
If you see the attached image the yellow (bullet) sphere passes right through the green (asteroid) sphere. If they collide right at the middle of the green sphere (the center of the green cross) then the collision occurs correctly.
Is this a limitation of the engine? Can I fix this or do I just have to make all my spheres bigger (not a fix)? Any help would be greatly appreciated.
Thanks.
Answer by iPedro · Sep 30, 2011 at 06:00 PM
Thanks guys for your good ideas. As it turns out the problem was the the bullet sphere was slightly off the z axis (-0.454 or something) and as result it was going just underneath the asteroid sphere at the sides but making the collision if it was hit dead on.
The moral of the question: Always check your axis first :-P
Thanks again
Answer by aldonaletto · Sep 30, 2011 at 03:12 AM
The collision occurs when any part of one collider touches the other. I suspect your problem is the speed: since collisions are verified periodically (at the FixedUpdate 20mS cycle, I suppose) maybe one object is before the other in one cycle, and after it in the next, so no collisions are detected. You can modify it changing the rigidbody.collisionDetectionMode: set to CollisionDetectionMode.ContinuousDynamic in the fast moving object, and to CollisionDetectionMode.Continuous in the target object. This spends much more time than discrete collision detection, so use it only when needed.
Answer by jonas.du · Sep 30, 2011 at 09:15 AM
There are different ways to solve your problem,
the rigidbody.collisionDetectionMode as mentioned by aldonaletto
lowering the physics time-step, this has performance issues
use a raycast to detect collisions, example script from the unifycommunity wiki