Two moving kinematic objects collision resolution

I’m building a collisions system using only kinematic shapes, using this code as a base:

The collision resolution of a moving kinematic object colliding against a passive kinematic object works well. But when they’re both moving, they are both moved at the same time (because the collision message is sent to both game objects) resulting in a gap between them.

Has anyone tried to do this before? What’s the approach to moving more than one game object at a time, such as a player, a moving platform and an enemy?

If I had the chance I’d use dynamic objects and allow Box2D to do all the work, but because of the limited support for dynamic bodies and forces in Defold I’m trying to build this system instead.

You could give one or the other priority and resolve only one of them. Or you could keep a global list of resolved collisions and ignore collision pairs that have been resolved already.

1 Like