FPS character elevator trouble

Godot Version



The problem is, that I have an elevator, it uses an animation player to go up and down,
But when the player gets on it while going up, the player will sink into the floor,
I’m not sure what causes this. I’ve tried making the elevator a character body, and I’ve tried keeping a animatable body3D
But both have the same problem.
An animatable body3D has a feature called sync to physics but when I check the box. the elevator won’t move period. Could somebody tell me what I can do about this?

what does the nodes look like for the elevator?

  • Animatable body (root)
    • meshinstance3D
    • collisionshape3D

It might be because you move too fast or maybe you put your moving script in process func

elevator motion is controlled via animationplayer

Have you tried reparenting the player to the elevator while the player is in the elevator?

Hmmmm I would, but it would be extra code that would make it difficult. I’m hoping there’s an easier method but this would be a working last resort

This is the node setup that I use which works:

  • Node3D (to contain and position the elevator animation)
    • RigidBody3D (Freeze set to true, and Freeze Mode set to Kinematic)
      • MeshInstance3D
      • CollisionShape3D
    • AnimationPlayer

My character(s) is a regular CharacterBody3D.
This moves the character with the platform whenever it moves.

I haven’t tried using AnimatableBody3D and so I can’t comment on using that, and the docs description has me confused as to what a RemoteTransform3D is. It seems to be required when moving the animatable body:

Just to make sure - the character body and elevator body are able to see each other through the collision masks and layers, right?

It’s worth the effort.

In my own game, all Entity subclasses (I have a base Entity class from which most other game objects are derived) have collision shapes (naturally). When a player or NPC walks onto an object, it is automatically parented to that object.

This provides a lot of automatic benefits, with the most relevant one being that it moves with the object. When the parent (such as an elevator) moves, the player/NPC automatically moves with it. I don’t have to write any other special code to handle the situation, as the capability is systemic to all Entity subclasses.

It’s a little bit of work up-front, but the payoff is well worth it. It works so well and so transparently that I had almost forgotten I had implemented it.