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

RigidBody3D does not unlock when lock_rotation set to false #245

Open
Teufelauto opened this issue Sep 1, 2024 · 3 comments · Fixed by #270
Open

RigidBody3D does not unlock when lock_rotation set to false #245

Teufelauto opened this issue Sep 1, 2024 · 3 comments · Fixed by #270
Labels
bug Something isn't working

Comments

@Teufelauto
Copy link

Describe the bug

'lock_rotation = false' does not free the RigidBody3D to rotate freely. It can be rotated by transform.basis, but when dropped, the body does not rotate. The check-box in the Inspector behaves correctly, but the body rotation remains locked.

To Reproduce

For a RigidBody3D, set lock_rotation = true in the Inspector, or by code. Setting lock_rotation = false will not unlock the rotation.

I have provided a test project below that requires the Addon folder with Rapier installed.

  1. Run the project. I must note that if the Godot Editor is moved to my second screen, running the project will cause the cube not to reset to the starting position. IDK what to do with that info.
    1a. The left cube is frozen, showing a separate bug relating to starting frozen identified elsewhere. Please disregard it.
    1b. The right cube will fall when the app runs, and come to rest normally on one side.
  2. Clicking 'Drop Cube' will return the cube to the start position and drop it again at a random starting rotation.
  3. Clicking 'Lock Rotation' calls function that causes lock_rotation = true.
  4. Clicking 'Drop Cube' sets lock_rotation = false, returns the cube to its starting location, randomly rotates it, and lets it fall.
  5. Observe the cube does not rotate onto a face after it hits the ground, remaining in the same orientation as when it was released, balanced on a vertex.
  6. Commenting out 'lock_rotation = false', shows transform.basis still allows rotation to be manually set while locked.

Expected behavior

Setting lock_rotation = false should allow the RigidBody to rotate due to the effects of gravity, impacts, or other processes.

Environment:

  • OS: Windows
  • Version v0.8.2 and v0.8.4
  • Godot Version v4.3
  • Type godot-rapier-3d-single-simd-parallel

Example project(zip)

rapier_lock_rotation_test.zip

@Teufelauto Teufelauto added the bug Something isn't working label Sep 1, 2024
@Ughuuu
Copy link
Contributor

Ughuuu commented Oct 6, 2024

Interestingly, it seems the transform is not set and the bodies don't move back again. My initial guess is the freeze state maybe does something to the shapes that resets them and transform is not applied.

@Ughuuu
Copy link
Contributor

Ughuuu commented Oct 6, 2024

As for the lock_rotation, I forgot to update it, fixed that. The position not updating is still not fixed, so leaving this open.
The fix will enter in 0.8.6(for lock_rotation)

@Ughuuu
Copy link
Contributor

Ughuuu commented Oct 7, 2024

Just partially fixed, got closed automatically by the PR bc it found the work "fix"

@Ughuuu Ughuuu reopened this Oct 7, 2024
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

Successfully merging a pull request may close this issue.

2 participants