Closed funjobie closed 11 months ago
not sure if its in any way related but i also see two errors in the console:
src\box2d-wrapper\box2d_wrapper.cpp:1023 - Condition "half_height < radius + 0.00001f" is true. Returning: invalid_shape_handle() src\shapes\box2d_shape_2d.cpp:25 - Error creating the shape
It is. It seems it doesn't create the shape correctly. I'll take a look.
I'm courious, why should the physics engine never change the rotation of an animatable body? It does change the rotation also in Godot Physics it seems.
I'm not 100% sure I understand what the issue is.
Ok, I think I see what's going on. How the kinematic body works currently, I set an angular velocity to the body until final state. I think in this case, the angular velocity is way too big, or it tries to go to wrong direction(angles have sign, so if it tries to go from 1.5 to -1.5 the longer way, the velocity might be bigger). I could just teleport the body to the new rotation in this case.
Well regarding my expectation. i am far from an expert, but this was my interpretation of the godot node documentation
"A 2D physics body that can't be moved by external forces. When moved manually, it affects other bodies in its path. An animatable 2D physics body. It can't be moved by external forces or contacts, but can be moved manually by other means such as code, AnimationMixers (with AnimationMixer.callback_mode_process set to AnimationMixer.ANIMATION_CALLBACK_MODE_PROCESS_PHYSICS), and RemoteTransform2D. When AnimatableBody2D is moved, its linear and angular velocity are estimated and used to affect other physics bodies in its path. This makes it useful for moving platforms, doors, and other moving objects."
which my reading was that the position/rotation is only changed explicitly by the user in order to affect other nodes. As opposed to RigidBody2D, which is not meant to be controlled directly but rather only in response to physics.
True. I just read your issue and it says there:
Expected behavior I expect the physics engine to never change the rotation of an AnimatableBody2D
That's what threw me off a little. Yes, you should change rotation or position, and the physics engine will estimate the velocity based on that.
I pushed a fix, it fixed the issue in my test. You can check it after it builds on master.
thanks!
Thanks for reporting it!
Describe the bug I have a AnimatableBody2D that i rotate based in user input. (2 pinball flippers). somehow, and only with bod2d enabled, one of them gets rotated by physics.
To Reproduce Steps to reproduce the behavior:
Expected behavior I expect the physics engine to never change the rotation of an AnimatableBody2D
Project flippers_rotated_2023_11_19_1.zip
is attached
Versions (please complete the following information):