- Home /
Collision between two moving objects (Kinematic)?
Hey, what's the most optimal way to do collision detection for two (Or more) objects without physics? They are both instantiated from the same prefab, and will also be colliding with static trigger zones (Think speed up zone, etc.) Since a collider with isKinematic, can't collide with another with isKinematic, does that mean I should have them both be triggers? And then have the trigger zones also be triggers?
Is there a better way? It seems like a weird solution :/
Answer by Mr_FJ · Sep 15, 2017 at 09:35 AM
I guess the best way may really be to just make them all triggers.
Answer by Bunny83 · Sep 13, 2017 at 09:33 PM
A Collision in terms of physics consists of two things:
collision detection (intersection detection)
collision response (a physical reaction to the collision)
Kinematic rigidbodies are not physics objects because they can't receive a collision response as they are not driven by the physics system.
However kinematic rigidbodies can detect intersections with triggers. Triggers basically encapsulate only the intersection detection part. There's no information of "collision points", collision normals or the collision velocity. You only get the information when you enter a trigger, when you are inside a trigger and when you leave that trigger.
If you need more information about the collision you have to use non-kinematic rigidbodies.
In your specific case, what would you like to happen when you detect a collision? Since you move the objects "manually" they won't "collide" and somehow stop. This can only be achieved when using the physics system as this sort of "correction" can only be achieved when the system is allowed to correct the motion (collision response).
If you need further help, be more specific what exactly you want to happen.
Thanks for taking your time to answer.
In this case, one of the two colliding objects has a "priority" tag (bool) set, so when they touch, the one without the priority tag should be destroyed (After fading away).
All the destruction and fading logic is complete, I "just" need to figure out if/when they intersect, without checking each update loop, as this is going to happen fairly often.