Can objects "go through" walls in a very low framerate?

Godot Version

4.3

Question

When the framerate got very low, the animation of objects of the game will start to look stutter or more like a quick slideshow. And when objects move, they will move more distance in one frame thanks to delta time.

Suppose we have the player object and a very thin wall, then the player move very quickly to the wall, if the framerate is high, the player will stop at the wall. Now, if the framerate is very low and deltatime is very high, the next position of the player could be beyond this thin wall.

I used to come across a few game engines that have the player “teleported” beyond the wall. A quick fix is to make all the walls extremely thick but if your stage is designed to have thin walls aesthetically, then this is not feasible.

My question: does Godot’s internal engine take care of this or will the object be teleported beyond the wall in a very low framerate situation?

That’s a good question. I don’t know how Godot’s internal physics work, but I can make an educated guess that Godot uses static collision shapes. For example, if two bullets moving toward each other have a high enough velocity, they can pass right over each over from one frame to the next, even though we can see that they should obviously collide. This is because Godot uses static collision shapes. That is, they do not deform to account for motion.

With that in mind, it is entirely likely that extremely low frame rates would allow for exactly what you described.

If you are using a RigidBody you can turn on Continuous collision detection.

CastRay will use a raycast to detect passthorugh.
And Cast Shape will use a shapecast that is more precise, but much more expensive

collisionCD

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.