• 2D
  • Directional attack animation outside of AnimationTree.

I'm making a top-down game, and I have 4 sword animations, which need to play accordingly to the mouse angle (left-right-up-down) with a prioritization of left-right attacks. As I'm very new to coding, I haven't really touched the "angle vector etc." topic, so I thought I could just setup the angles in AnimationTree. The problem is, however, is that for some reason I can't just play the animation from AnimationTree, I can only use the set and travel functions. And that is huge problem, because I'm not using an AnimationTree for player animation, but a state machine, just so I could play Idle/Run animations at the same time as the attack, for example. So how do I setup a mouse directional attack animation using the "AnimationPlayer.play" function?

4 months later

I used this video to set up an animation tree

I think you could adapt it to work for your game, you could detect where the mouse is to set the position on the animation tree instead of using input events, but I'm not 100% sure, it may be helpful