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

Groove joint behaviour different than default Godot2d physics #317

Open
Selus opened this issue Dec 10, 2024 · 2 comments
Open

Groove joint behaviour different than default Godot2d physics #317

Selus opened this issue Dec 10, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@Selus
Copy link

Selus commented Dec 10, 2024

Describe the bug

In default Godot 2d physics engine groove joint allows 1 Translation + 1 Rotation.
In rapier groove joint only allows 1 Translation.

To Reproduce

Create groove joint and put it at an angle.
Connect two bodies, one body should naturally rotate depending on their center of mass.

Expected behavior

Body connected as NodeB should be allowed to freely rotate.

Difference

Godot2d:
godot2dgroovejoint

Rapier:
rapier2dgroovejoint

Environment:

  • OS: Windows
  • Version: latest
  • Godot Version: 4.4 dev 6
  • Type: 2d

Example project(zip)

rapier-bug-report.zip

@Kelin-Levine
Copy link

This is a bug that should probably be fixed to maintain parity with the default physics engine, but I think that this behavior should be kept in Rapier2D in some way as it allows for behavior that wouldn't be possible without it.

For example, if there were a game with a player character that spins a physically-simulated sword that can also be extended or retracted, then this behavior wouldn't be possible with the joints of the default physics engine. In the default physics engine, GrooveJoint2D doesn't restrict rotation (as you stated); the only Joint2D that can is the PinJoint2D, which also fully restricts translation.

There are unique applications for this "bug" that are only possible because of it. If this is patched out of GrooveJoint2D, I think that it (or a suitable replacement) should remain in some other way, perhaps as a new joint node.

@Ughuuu
Copy link
Contributor

Ughuuu commented Dec 13, 2024

Thats a good point, thanks for the note. If this is fixed, there will be a flag to set this behaviour, eg.:
RapierPhysicsServer.joint_set_flag(joint_rid, ..., true)
Or something like that. But by default it would have to be the default way godot does it now. Maybe in the future, if godot offers the option, I will expose this to the editor too.

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

3 participants