Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Joint2D doesn't respect StaticBody2D Scale #336

Open
OLedelay opened this issue Jan 22, 2025 · 1 comment
Open

Joint2D doesn't respect StaticBody2D Scale #336

OLedelay opened this issue Jan 22, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@OLedelay
Copy link

OLedelay commented Jan 22, 2025

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 OLedelay added the bug Something isn't working label Jan 22, 2025
@OLedelay OLedelay changed the title DampedSpringJoint2D doesn't respect StaticBody2D Scale Joint2D doesn't respect StaticBody2D Scale Jan 22, 2025
@OLedelay
Copy link
Author

OLedelay commented Jan 22, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant