360 Directional Aiming while letting AnimationTree/Player do some of the work

Godot Version

4.3

Question

I’m trying to rotate a Node2D that I’m using as a container for arms, by simply setting the rotation degrees of the container to mouse location. The thing is I already had the animations done before I decided to go back to attempting this, so my animations being controlled in an blend tree are off when I switch between them by certain degrees. I could remake all the animations but I was wondering if there was anything else I could do. These animations are for arm placement, position, rotation And texture of the sprite2d, replacing the arm entirely which was at a completely different angle so I would rotate it into the angle I wanted and now when it reaches the top right animation for aiming, it basically is facing almost completely upward because it’s offsetting thr animation by about 30 degrees. I wish there was just A rotation offset also.

I think I honestly would’ve been better off just with code.

Can you maybe provide an image of this animation? Im having a hard time understanding what exactly the problem is

Since I can’t upload here yet, idk what else people use to share videos but Supposed to work vs how it works - Album on Imgur one shows how it’s supposed to work. This is with code in a case by case basis, and the other one it’s how it actually works without me manually offsetting the rotation for each animation. There are various ways to fix this on a per animation, but I was hoping that there would be a simpler fix, as there usually is.

Hmm i dont know if there is a simpler way to do this

1 Like

Thanks for the reply, and sorry if it was confusing wrote that at 5am before I went to bed.

Just wish I could reset the rotation angle respectively every time the animation change, but since there is no rotation offset, don’t think it’s possible. If I change the animation to Add on the blendtree for blending idle movement animation and aiming animations instead of blend2 the angle of how much it skips, is a lot smaller. But the only way I could get the arms to move position in sync to match the idle animation even when changing aiming animations was with using blend2 instead. Well that’s without doing it manually.

could you make a rotation off set?

#have this call outside the indents
var rotationoffset =0

if idel
	rotationoffset = #whatsneeded
elif aiming
	rotationoffset = #whatsneeded

rotation = angletomouse + rotationoffset

this mightn’t help, but this is my approach for this problem
edit:
beware of radians and degrees

I mean this is how I managed to fix it. Unfortunately it is per animation basis it’s not just a direct offset. As when I use the top right arm, it’s actually -45 degrees, but the bottom arm is facing downwards so it needs a different offset. The way I currently bypassed this headache. Is by storing the value of the radian facing the mouse, and then if the radian is between a range I apply and offset. Then I blend the original to the AnimationTree so it doesn’t mess when the animation should change. So I have to do every animation and offset it manually between their own range.