Animation Trigger

Godot Version 4.1


I’m trying to make the item descriptions appear from outside the screen when looking at them, and then disappear when looking away. I’ve made an in and out animation of a Description Scene (which is a Control Node with Labels, Animation Player and Animation tree). But I’m totally clueless rn. What code should I use and where? Should I type anything in the Raycast script? And what about the Control Node script?
Thanks in advance.

like in 3d waypoints demo?

not exactly but this is interesting as well. In my case the in animation should play only when the raycast touches the collision shape, and the out animation when the raycast moves away.

Not sure I fully understand how you’ve set up your project, but to me it sounds like making the raycast sends some signals that you then use for your description control node might be the way to go.

This is how i’d approach it:

  • Make your raycast send a signal that passes the collider of what it hits.
  • Make your description listen to said signal.
  • If the passed collider is an object with a description, play the in-animation and store the passed collider as a current object.
  • If the passed collider doesn’t change compared to current object, do nothing.
  • If the passed collider object changes to a different object or null, play the out animation.
1 Like