When using a KinematicBody, there is a useful
move_and_collide() method which allows the user to move the body while preventing it from clipping through other collision bodies. What is the best way to emulate this behaviour with a RigidBody in MODE_KINEMATIC?
I have implemented a FPS puzzle game (in Godot 3.0 alpha 2) where the player can pick up and position objects (e.g. putting a box on a table). The objects which can be picked up are currently KinematicBodies and the collision detection is handled by using KinematicBody's
move_and_collide() method to prevent the objects from clipping through other objects.
However, I realised that, when you put an object down, gravity needs to act on the object. Accordingly, I converted the KinematicBodies into RigidBodies and specified that they should be in MODE_KINEMATIC when being carried by the user (switching back to MODE_RIGID when dropped). However, my original code did not work any more because the
move_and_slide methods are no longer available.
I have created a GitHub issue asking whether it is possible to make KinematicBody methods available when RigidBody is in kinematic mode - see here:
However, in the interim, I would be grateful for any suggestions as to how best to emulate KinematicBody's
move_and_collide() method for RigidBody in Kinematic mode? Presumably this would need to be handled somehow in the
_physics_process() callback? Also, the docs state here that:
As a warning, don't change RigidBody's position every frame or very
often. Sporadic changes work fine, but physics runs at a different
granularity (fixed hz) than usual rendering (process callback) and
maybe even in a separate thread, so changing this from a process loop
will yield strange behavior.
Is this warning relevant when the RigidBody is in kinematic mode? If so, how can we move the RigidBody so that it follows the player's first-person view while being 'carried' by the player?
Surely it can't be impossible to implement an object that can be picked up and then become subject to gravity when put down?