0 votes

Hi all,

I have a character. I created him in a scene with a Node2d as his root, then added all his bits n pieces and animated them in that scene. I need to animation position, rotation and scale for the animation to work (moves up and down etc).

I then created another scene, the game level. I put the character into the scene (instanced) and then move the character into place. The character stays in place until I play the animation. At that point the character jumps to where I created the animation in the original scene file.

Can anyone offer some advice as to why that's happening and how I can overcome it?

I noted an old question on this topic and the advice was to remove the position keys, but I need the position keys as I animate the relative position of the character.

Any help GREATLY appreciated on this one! :-)

asked Oct 22, 2016 in Engine by Robster (808 points)

Based on the limited information, my only guesses are that you might be keyframing the wrong properties, or in your character scene you're having the character wander away from the origin.

The animation you do inside the character scene should do it's best to start and end around the center of the root node's origin coordinates. Then above that in the parent scene, you will move the root node to give actual world movement.

But I can't really say for sure.

There is an open issue on github related to this. Bojidar mentions fixing the problem by adding an additional parent Node2d. Just tested it and it works fine for platforms & such but is kinda clumsy for characters.

Thanks to everyone. Embarrassingly it turns out I'd coded some global locations via the level scene when testing a few weeks ago and forgotten about it. Total human error in the end. The thread gave some good info though, so that's always worthwhile.

1 Answer

+1 vote
Best answer

You can fix that problem by not animating any of the properties found in the root Node2D. Because if you do, that node will obviously move relative to whatever its parent is once instanced. I made the same mistake recently but it actually makes sense to not touch the root at all, that's what it is meant to be: make its children local to it.

answered Oct 22, 2016 by Zylann (27,008 points)
selected Oct 23, 2016 by Robster

Great response thank you.

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.