2D Physics not working as I want it to

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By NoxL

Hello,

I have made this test where a ball (StaticBody2D) is control via the mouse, and can interact with falling objects (RigidBody2D). Link to Image here

All is working well but I have this huge issue where if the mouse is too fast it goes through the object. I wonder if it is because the collision detection occurs every frame, but do someone has a solution for this ? I tried everything.

Thanks so much !

:bust_in_silhouette: Reply From: Inces

set continous_cd property of rigid bodies to true

Already tried to set it to “Cast Ray” or “Cast Shape” but it changed nothing.

NoxL | 2021-11-03 17:08

It won’t work wth ccd turned on for both objects and controlled ball ? This must be a problem with movement code. How do You control the ball ? Try using RigidBody methods ( calculate forces ) instead of overriding global_position every frame

Inces | 2021-11-03 19:33

Oh now I understand, I only changed the position to be equal to the mouse position. Now I get it thank you so much :slight_smile:

NoxL | 2021-11-04 10:35