Having a problem with the 'Calculate Direction' node in Blueprint


I’m trying to use the Calculate Direction node in my character’s Animation Blueprint to feed a direction variable in my movement blendspace. I have an axis in the blendspace that ranges from -180 to 180 which correlates with the output of this node.

For the most part, things work well with this node. However, I notice a problem when I turn, then try to move straight forward again.

I hooked up a print string node to the output of this node to see what value the Calculate Direction node was outputting. Starting the game and moving forward works as expected, the value is roughly 0. If I turn to the left, then move forward, the number is slightly higher, all the way up to around 25. It’s the same for turning to the right, except the value is negative. I also have the problem when moving straight back. The result is that my character runs straight forward/backward, but runs slightly at an angle, since the blendspace is wanting to blend towards my ‘run sideways’ animation.

Here is a picture of how I have it connected in my blueprint in case I’m getting something wrong. I appreciate any help!

Did you find an answer for this?

Unfortunately, no. I haven’t messed with this node for a while now, is it doing the same thing to you?

@Obsidiaguy , @KitatusStudios
I’m having the same problem, open the sample project third Person and sent calculate diracao, but he still returns 90 degrees instead of 0. any solution? what am I doing wrong?

I got this node working properly for my usage and wrote a write-up on the forums: "Calculate Direction" node for blendspace direction - Character & Animation - Unreal Engine Forums

The primary purpose of this node is to get an angle for an animation start, which as I understand, isn’t what you’re trying to do. It sounds like you just need to pass in your axis values forward and right for a running blendspace so that it uses the proper animation. I may have read your post wrong though.

I don’t believe this answers the original question, because I’m having the same issue. Our issue is that axis/mouse input affects the direction calculation, and we want to negate that data to get the pure movement direction ignoring the axis input.

You should open a new question here or on the forums, with any relevant blueprints and transition logic. I’m about 1700 miles away from home, so I’m not of much help right now. IMO, the best solution is to write a function that takes current forward vector and the forward vector of control rotation if it were projected perpendicular to the player component, and get the angle of those two vectors.

I’m having a similar issue: https://answers.unrealengine.com/questions/810957/animation-effecting-navigation-speed-and-direction.html

Old topic, but as it’s the first one that popped up for me, might pop up for others. I solved it quickly by just breaking and remaking rotator without pitch rotation: