Bones modified in AnimGraph don't retain world rotation when actor changes directions

I have a mech unit in my game that is supposed to have its torso rotate independently of its legs. The torso is supposed to look in the direction of the mouse cursor while the legs face the direction of movement. I have that all working but when you switch what direction you’re moving it just breaks for one frame, which is surprisingly noticeable. It gets even worse if you try to walk into a wall. It looks like the torso retains its relative rotation when you switch directions instead of its world rotation.

Since a text description probably isn’t all that clear, here’s a small PNG sequence I captured, the first frame it’s moving left, the second is when I switch directions and start moving right, and in the third it continues moving right.

86404-movingleft.png

86405-transition.png

86406-movingright.png

As you can (hopefully) see the torso is facing down in the first and third frame and the feet are facing the direction it’s moving, but in the second frame the torso faces up instead (the feet are facing the right direction though).

Here are screenshots of my Anim Graph and the settings for the “Transform (Modify) Bone” node:

I update the TorsoRotation variable in the BlueprintUpdateAnimation event. I’ve tried also updating it in the PostEvaluateAnimation event as well with no luck. I also tried updating it in the Locomotion state machine’s StartTransitionEvent and EnteredStateEvent, as well as putting the stuff in the AnimGraph into custom blend logic for each transition to no avail.

Thanks for any help you might be able to provide.

I figured out a solution for this problem, though it feels kind of hacky. Instead of rotating the actor in blueprint, I made the actor always face the same direction (which doesn’t affect any gameplay for us) and just rotate the root of the model in the animation graph instead. Not the best solution but it looks correct which is the most important thing.