0 votes

Hi there.
I have a sprite with an AnimationPlayer as a child of it, along with another sprites too. The AnimationPlayer animates the main sprite (parent) but I need it to animate the other sprite nodes too (children). I already have the animations made for the parent sprite, the issue is that I want to use the exact same animations but with the other children sprites. As Godot does not have a copy/paste keyframes in different track feature, I was thinking about setting the children's frame value the same as the parent sprite's animated frame value in process() function, but that may produce a bad perfomance, so I was wondering if there is a signal or a way to know when does the frame property in the parent sprite changes value to set it to the children sprites too.

in Engine by (97 points)

Would it be possible to instance the animation player as a child scene or several children of the original animation player? Something like this:

enter image description here

And start them all at the same time?

So you're suggesting that I add an AnimationPlayer as a child of the already existing animation player for each of the sprites that I want to animate, just change the target to the corresponding node and the properties should change just like when changing the position of a parent node changes the children's position too?

1 Answer

0 votes

I may be wrong, but as far as I can tell, there is no "driven values" mechanism in Godot, like in Blender for example, which is a shame, and would be a very valuable enhancement IMHO.

I've tried to emulate this facility in a little example, using scripts and signals. In the attached example, I've added a public variable to the parent sprite, "Driver" that I animate instead of animating the scale directly, in the setter for that value, I emit the driven value changed signal. It's possible then to hook that signal up to whatever you want to be driven by the changes. In this example, I hook it up both internally to the scale, and then hook separately into the child sprite, "Driven", to alter its scale too. Unfortunately, this means it will be difficult to review the animation as you edit it, as the script on the driver won't run and you therefore will not see the effect of your animation as you play it.

Hope that helps a little.


by (18 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.