Changing transform through script

Godot 4.3

So its a 3D First-Person project where the player is pretty much just holding a task card, I want to make a script so whenever the player presses and holds down the F key they move the task card to be more in the players view so they can read it. As long as they hold down F it stays there and if they stop holding it down it goes back to its normal position. I am VERY new to Godot and scripting and game design in general so I will take all the help I get with this.

I would recommend using an AnimationPlayer, then you can have one animation for bringing the card into view and play it backwards to remove it from view

if event.is_action_pressed("ViewCard"):
    $AnimationPlayer.play("ViewCard")
elif event.is_action_released("ViewCard"):
    $AnimationPlayer.play_backwards("ViewCard")
1 Like

oh ok thank you, do you know generally how I would go about starting an animation? Like which specific window or menu do I need to enter for that in the Godot engine?

1 Like

AnimationPlayer is a node type, it opens a lot of changes to the editor interface including a bottom dock and keys to just about every property in the inspector.

1 Like

Nice thank you man!

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