Rigidbody2D passes through staticBody2 on faster movement

Godot Version

4.3.stable.mono

Question

I’m making a game where the player has the ability to move a pan and throw ingredients with it. My pan scene looks like this:

  • RigidBody2D
    – Area2D - responsible for catching player’s mouse input
    – StaticBody2D - The body of the pan where we hold the ingredients (it has no scripts attached)
    Of course, everyone has a CollisionShape2D

My ingredient is just a RigidBody2D with its CollisionShape2D

The pan has a dragging mechanism with the mouse (speed of dragging is limited). When the ingredient lands on the pan, everything is fine, StaticBody2D blocks the ingredient from passing through it. The problem starts when we try to move the pan, if I do it very, very slowly, the ingredient doesn’t pass through, but if I just yank the object a little harder, the ingredient flies through StaticBody2D.

StaticBody2D has only changed layer and mask to match the ingredient.

Ingredient’s RigidBody2D changes:

Default PhysicsMaterial with the bounce changed to 0.25

Can Sleep changed to False
Lock Rotation disabled

CCD changed to Cast Shape

What should I change to make it work? I’m having a hard time with it.

Try changing physics_ticks_per_second to 120 in project settings

When StaticBody2D is moved, it is teleported to its new position without affecting other physics bodies in its path. If this is not desired, use AnimatableBody2D instead.

This may be relevant to what you’re experiencing. Have you tried switching the body of the pan to an AnimatableBody2D?

1 Like

Thank you so much, it helped.

I had another problem, because the AnimatableBody2D area couldn’t be moved (I think it’s a bug). But found solution for it. If You have the same problem check this issue: AnimatableBody2D doesn't work when parent moves · Issue #58269 · godotengine/godot · GitHub