In general, you do not want to move a RigidBody node directly, especially not in _process
as its called every frame (rather than every physics update). The documentation explains this a bit, but the gist is that it will break the physics simulation.
Instead, you want to operate on the forces and velocity of the RigidBody node to move it around. Functions like add_force
, add_torque
, apply_impulse
, and apply_torque
can be used to change these values. You will generally want to call these functions in _physics_process
, which is called every physics update, so the RigidBody state is the most up-to-date when calculating.
You can also directly modify the position and forces in the _intregrate_forces function, which is called when the RigidBody itself updates. This should allow you to move the RigidBody around and it sill have velocity as expected.