appsinacup/godot-rapier-physics

Removing shapes from a body doesn't work

lonevox opened this issue · 1 comments

Describe the bug
With GodotPhysics2D I can remove shapes from a body when the shape is collided with via PhysicsServer2D.body_remove_shape(). Shapes don't seem to be removed properly in Rapier2D.

To Reproduce
Steps to reproduce the behavior:

  1. Download the example project.
  2. Run it (the project uses GodotPhysics2D by default). You will see that the shapes are removed when colliding with the floor (the drawn polygons remain to make it easier to see that the body no longer has shapes and falls through the floor as expected).
  3. Switch the physics engine to Rapier2D. The shapes aren't removed when colliding with the floor, and behave strangely as they would normally tip over (you can see them tip over if you make destroy_shape_on_collision false in rigid_body_2d.gd).

Expected behavior
Rapier2D should behave in the same way as GodotPhysics2D.

Videos
GodotPhysics2D:

godot-physics.mp4

Rapier2D:

rapier.mp4

Environment:

  • OS: Windows
  • Version: v0.6.21
  • Godot Version: v4.3-beta1
  • Type: simd single

Example project(zip)

RapierBug.zip

Fix by re-updating the shape indexes after a shape is deleted/removed.