I have a pushable box as a RigidBody2d (Rigid mode).

As shown on this video, where left half of the tiles of this floor have full collision and half right have one way collision on top, the body slides through the right tiles.

What could it be?!

I tried to use Character and Kinematic Mode and they gave me another weird problems...

I would try setting your box's continuous_cd to Cast Shape. That might help with the accuracy of the one way collisions.

Another thought... you could try increasing the one way collision margin on your platform's collider shape.

@bitshift-r said: I would try setting your box's continuous_cd to Cast Shape. That might help with the accuracy of the one way collisions.

@bitshift-r said: Another thought... you could try increasing the one way collision margin on your platform's collider shape.

Sadly neither of them worked. Only when I use full collision.

When I try to change the RigidBody2D to Character mode, the box sometimes gets stucked while pushing.

What happens when the player pushes the box? Are you applying an impulse to the box or setting its position?

I had a moveable object once that was sinking into the floor, but it was a KinematicBody2D. Of course I had to integrate my own pushing, but I was also able to add pulling. Anyway, what was happening was that I was using move_and_slide to push the object down each frame to apply gravity, and counting on the collision detection to keep it on the floor. But when my player stood on top of it the collision couldn't resolve, so it would slowly sink.

I ended up solving that problem by using move_and_collide with test_only set to true. Then I would only apply gravity only if I wasn't colliding with the ground.

And yet another thought... if your box's collision shape is a rectangle you might try drawing a polygon instead and chamfering the edges just a bit. That's helped me with some odd collision issues in the past.

11 days later

@bitshift-r said: What happens when the player pushes the box? Are you applying an impulse to the box or setting its position?

I had a moveable object once that was sinking into the floor, but it was a KinematicBody2D. Of course I had to integrate my own pushing, but I was also able to add pulling. Anyway, what was happening was that I was using move_and_slide to push the object down each frame to apply gravity, and counting on the collision detection to keep it on the floor. But when my player stood on top of it the collision couldn't resolve, so it would slowly sink.

I ended up solving that problem by using move_and_collide with test_only set to true. Then I would only apply gravity only if I wasn't colliding with the ground.

Cool tips about the test_only and the collision shape with angled corners. I'll try both!

Currently I'm using RigidBody2D with Character mode, but it's not great yet...

Here some gameplay I recorded. Box issues on the last minutes.

2 years later