This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
+10 votes

Hi,

I want to switch the behaviour of a Rigidbody2d node from kinematic to rigid and vice versa. Currently I am trying out 3.1 beta2.

What confuses me however, is how to properly move the rigidbody, when in kinematic mode. What i find is, that i should be altering the position directly, which is what is stated one should not do, reading from the documentation.

After debugging the behavior of the body. I found that It looks like, once in kinematic mode, the body's state is forced set to sleeping (though cansleep is false), and the _integrateforces function is not called. Applying forces or impulse won't move the body, so altering the position(setposition/setglobal_position) is all that's left. And once I do that, integrate is called, the body moves and is interacting with other bodies in the scene.

https://docs.godotengine.org/en/latest/classes/class_rigidbody2d.html#enum-rigidbody2d-mode

According to the latest doc, it should behave like the KinematicBody2d, but in the rigidbody class, we don't have access to the "move_*" functions , which is the recommended way to use that node type.

in Engine by (22 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.