How to properly move Rigidbody2d in kinematic mode?
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.
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.
Asked already on on the QA site, but I thought I'd add it here as well.