-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
RigidBody2D ignores set_position when switching between MODE_RIGID and MODE_STATIC/KINEMATIC #10959
Comments
We have now entered release freeze for Godot 3.0 and want to focus only on release critical issues for that milestone. Therefore, we're moving this issue to the 3.1 milestone, though a fix may be made available for a 3.0.x maintenance release after it has been tested in the master branch during 3.1 development. If you consider that this issue is critical enough to warrant blocking the 3.0 release until fixed, please comment so that we can assess it more in-depth. |
I found a way to workaround this problem: After setting the position/rotation you want, keep the corresponding transform. Then in the _integrate_forces(state) function apply the transform to the state. |
Setting position on a CollisionObject should set the state transform too, then? (I wonder if that could solve some issues on other objects, like moving areas) |
This will not work because position is not sent immediately to physics when you change to staticbody, but the use case is really weird, I wonder if its worth working around it somehow to make it work |
I can think of many use cases for teleporting bodies in any mode, state access should be easier (and safe). |
Still valid in 3.2.3 |
Operating system or device, Godot version, GPU Model and driver (if graphics related):
Windows 10, current master branch (6d233c6), nVidia GeForce GTX 1080, driver version V385.41 (but probably not related to GPU)
Issue description:
When switching a RigidBody2D to
MODE_STATIC
orMODE_KINEMATIC
, changing its position, and then switching back toMODE_RIGID
and applying an impulse, movement starts at the position where the previous movement stopped, not at the current position.Steps to reproduce:
In the example project, move the ball to the green area and click LMB to launch the ball. Move to the red area and click the button again to attach the ball to the mouse. When moving the mouse the ball sticks to the mouse position as expected. Click the mouse button over the red area; the ball will launch in the green area, not from its current position.
Link to minimal example project:
2D-Physics.zip
The text was updated successfully, but these errors were encountered: