Animating an elevator that stops at a chosen floor

Godot Version

v4.3flathub

Question

Hi all, I am looking for some general advice on creating an elevator that stops at a floor that the player chooses. I am unsure what approach to use here.

Currently, I am trying to set up an AnimationPlayer with keyframes representing the different floors and then moving between those keyframes in code based on user input. However, I have read the documentation and I’m still unsure how to transition between specific keyframes in code. The below method seems to set the value of the key which could be useful to generate the keyframes in code but I’m unable to see a way to move between keyframes in code depending on user input.

I also found some advice to use a Call Method track where you call a stop() method on the animation when the correct floor is reached. Again I understand the logic behind this but it’s actually implementing it that I’m not grasping. Is this is a better approach than the above?

I’d recommend Tweens instead; Animations are great if you know the Animation’s starting and end position of specific nodes, Tweens are great if you do not know the start or end or how many things are to be animated

3 Likes

Yes, I found out about Tweens in another tutorial and they’re far more suitable. I can use Tweens to simply move the elevator a set distance from wherever it is at the time. No need to skip through an animation.

Thanks for your help!

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.