How can I rotate a 3d object while playing an animation in the animation player?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Brinux
:warning: Old Version Published before Godot 3 was released.

Say I have an object (robot, guy, etc.) facing left.
I want him to appear “alive”, so I play an “idle” animation where he stands there and be-bops, waiting for user input.
Now I press RIGHT - I play the animation of turning to the right. So far, so good…
Next, I set the object to spin to the right self.set_rotation(Vector3(0,deg2rad(180),0))
Finally, back to playing the idle animation in the animation player.
HERE’S THE PROBLEM:
Since the “idle” animation was created (in blender) facing LEFT, as soon as the animation player starts playing the “idle” animation, he’s facing left again, not right as he should be.
QUESTION:
How do I rotate an object (around the Y) axis with an animation playing? Because it appears the animation player overrides anything you set in your scripts.
Thanks in advance for the help!

I aint no expert but have you tried to place it on a 3d node(cant recall the name) and rotate its base? while the animation is on the actual model?

rustyStriker | 2016-11-04 10:15

Just tried it. That totally worked. I put the entire deal as the child of a rigidBody and rotated the rigidBody instead and it works perfect!
You must be an expert :wink:
Thanks!

Brinux | 2016-11-04 11:57

Keep in mind everything you animate with AnimationPlayer can’t be set by script or inspector afterwards, since it will override the values you give. You would want to animate a local transformation and set a parent transformation for scripting stuff, so they won’t conflict with each other.

Zylann | 2016-11-05 13:33