appsinacup / godot-rapier-physics

Godot Rapier Physics – A 2D and 3D drop-in replacement for the Godot engine that adds stability and fluids.
https://godot.rapier.rs
MIT License
328 stars 16 forks source link

RigidBody won't unfreeze when starting frozen. #242

Open DragonController opened 2 weeks ago

DragonController commented 2 weeks ago

Describe the bug

When a RigidBody is set to be frozen when you first run a project, you can't unfreeze it.

To Reproduce

Make a RigidBody and set it to be frozen (I also set it so it can't sleep). Attach a script to the RigidBody that allows you to toggle if it is frozen (I set it to the F key). Unfreezing the RigidBody does not appear to do anything (the RigidBody is unaffected by gravity and my script to move it with the A and D keys does nothing). However, if you start the RigidBody as unfrozen, the script works as expected.

Add steps here

Expected behavior

I expect that when a RigidBody starts frozen and then is unfrozen, it would act the same way as if it starts unfrozen.

Environment:

Example project(zip)

bug-testing.zip

Teufelauto commented 2 weeks ago

I can confirm that this effects 3d, as well.

My example has one cube that is frozen and one that is not, suspended in air. Running causes expected behavior, but clicking button that sets frozen to false changes checkbox in Inspector, but cube remains suspended. There is another bug illustrated in the file, for which I will open its own issue.

Environment:

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

Example project(zip) rapier_lock_rotation_test.zip

Teufelauto commented 1 week ago

Edit

Unfreezing in Scene, and freezing in the Script works as a band-aid if starting a new project...

I'm having more problems with migrating than I had hoped. Dice just jitter after being thrown, and never sleep. idk. Not working with default physics, either. lol.

Original

I am going to have to work around this issue, so, unfreeze all my movable objects and put freeze in the _ready() function, because I'm up against a bug in 0.7.27 that would require me to destroy my instance after every dice throw to reset behavior to normal.

I've been using 0.7.27 to avoid this freeze bug, but ran into an angular momentum bug where throwing dice repeatedly gave them more and more spin-down time with each throw. This was fixed, because 0.8.2 works in my above test (after giving it some spin and some collision boundaries), but 0.7.27 has the accumulating spin issue.

I'm glad my project only has 11 movable objects.