Can't detect collisions when engine is paused?

By default, we don’t receive collision messages when the engine is paused. One case in which this happens is when the window is being dragged.

I wasn’t able to find a combination of Vsync, Use Fixed Timestep, or other game.project properties to solve this issue. The position animation is done in C++ through go.animate() and the collisions are passed through the on_message() callback, so I’m not sure if a fixed timestep is even relevant.

What’s the recommended approach here?

2 Likes

The problem is that the engine is paused while the window is moving, and when you stop moving it the engine resumes with a really large delta time. Starting with Defold 1.9.3 there is a new option in game.project in the Engine section called Max Time Step and it is set to 0.5 by default. This value defines a cap for the delta time to avoid situations such as the one you describe. Please updated to 1.9.3. Also, depending on the speed of the object it could be that the movement for 0.5 seconds still is so large that the collision shapes passes the line in a single frame anyway. If that is the case then either adjust the animation speed or lower the max time step.

4 Likes