godot-rapier-2d icon indicating copy to clipboard operation
godot-rapier-2d copied to clipboard

Joint2D doesn't respect StaticBody2D Scale

Open OLedelay opened this issue 11 months ago • 1 comments

Describe the bug

When a RigidBody2D is connected to a scaled StaticBody2D with a Joint2D at runtime, the joint attaches the RigidBody2D to the unscaled location of the StaticBody2D instead of the scaled location.

This applies to PinJoint2D, DampedSpringJoint2D and GrooveJoint2D.

To Reproduce

Steps to reproduce the behavior:

Open the attached project Install godot-rapier-2d-single-simd-parallel v0.8.8 from the AssetLib Run the project Click one of the buttons (plank / box) Press V to bring up a joint Hold LMB with the joint over one of the StaticBody2Ds to spawn an object

Expected behavior

The joint connects the RigidBody2D to the StaticBody2D at the displayed location instead of jumping all the way over to the pre-scaled location.

This expected behaviour is what is observed in Godot's default physics engine.

Godot's default physics engine doesn't seem to respect disable_collision/add_collision_exception_with for some reason, but that's a different issue entirely.

Environment:

  • OS: Linux (OpenSUSE Tumbleweed)
  • Version: v0.8.8
  • Godot Version: v4.3.stable.openSUSE [77dcf97d8]
  • Type: godot-rapier-2d-single-simd-parallel

Example project(zip)

rapier_game_test_issue.zip

OLedelay avatar Jan 22 '25 19:01 OLedelay

I just did some further testing, and when applying a scale to a RigidBody2D, the editor gives the following warning:

"Size changes to RigidBody2D will be overridden by the Physics Engine when running.

Change the size in children collision shapes instead."

However, this warning is not displayed when applying a scale to a StaticBody2D, and the behaviour is different.

When this warning is displayed on a RigidBody2D and you run the scene, the size is actually adjusted, whereas the size of the StaticBody2D is not visibly adjusted, and regular collisions use the scaled size of the StaticBody2D correctly.

OLedelay avatar Jan 22 '25 20:01 OLedelay