How to make a 3d model aim animation verticaly?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Leal05

So i have a 3d game with enemys with skeleton making animations for atacks but i dont know how to adapt the atack animations in case the target is above or below, i tried to rotate the arms and head towards the target with IK, it kinda works but ruins the animation because it set the position and i only what rotation ,also i keep thinking that Ik is not good peforrmace wise, is that true? its possible to rotate the bones direcly?or other methods.

:bust_in_silhouette: Reply From: stormreaver

I did something similar for my first-person aiming, though I am far from an expert in Godot’s animation system. I think the AnimationTree’s blend nodes would allow for far more flexibility than I implemented.

I imposed a restriction that my character could only aim vertically, and could not aim horizontally and vertically at the same time unless I rotated the character in the horizontal aiming direction. I animated my character aiming along the entire vertical space I allowed in the game, then used the seek() method on the AnimationPlayer to display the character in any arbitrary vertical aiming direction. The parameter to the seek() method was the total animation play time multiplied by a variable in the range of [0,1] which I calculated based on the mouse’s vertical position, which I intentionally made coincident with the vertical aiming range.

This gave me arbitrary vertical aiming, while horizontal aiming was accomplished by simple rotation of the entire character around the Z axis. This made simultaneous horizontal and vertical aiming possible with acceptable visuals.

With all that said, I intend to get better at Godot’s AnimationTree node, as I suspect it will allow for more flexibility with far less coding.

I meant that I rotated the character around the Y axis, not the Z axis.

stormreaver | 2023-05-02 00:07