Get Character Rotation Rate

Oh, oops! Yeah, I guess there’s a moment where Yaw goes from -180 to 180 and makes a huge bump.

The way around that is to replace the Float var “LastKnownYaw” with a Rotator var “LastKnownRot”, that stores actor Rotation… Then, when calculating DeltaYaw, rather than breaking the rotator and subtracting it’s Yaw float from last Yaw float, you would use a Delta Rot node to subtract one rotator from another and then break the RESULT for your Yaw value (Rotator math handles subtraction or addition in a way that compensates for sign flipping like that and makes for continuous curves).

My bad dude, I forgot that was gonna happen.

1 Like

No problem. You’ve already been a big help. Ill do my best to figure out the rotator stuff. Do I still need to apply delta seconds the same way? I assume I do.

Yeah but do it the same as you do now. What we’re changing is, instead of breaking two rotators (actor last frame, actor this frame), getting the yaws, and subtracting them, we’re subtracting two rotators (actor last frame, actor this frame), and breaking the result for the yaw. It’s basically the same mathematical operation, it’s just that doing it with rotators will cause UE to automatically normalize the rotation delta to the -180 — 180 range (i.e. moving from Yaw -177 to Yaw 177 is going to produce a delta rot value with a yaw of 6.)

From your explanation, I got this…but the results are…well…worse than before lets say. Am I doing something wrong?

Close, but don’t set the output of Delta Rot to LastKnownRot, set the output of Get Actor Rotation to last known Rot. Right now you’re telling the engine “last frame, my rotation was [the value of the last rotation minus the rotation before it]”, which is why it’s being wonky.

EDIT: also I think your division is wrong, you need to divide delta rot by delta seconds (since what you want is “rotations per second”, not “seconds per rotation”).

Beautiful…just beautiful…it works! Thank you so much! This really slowed me down but now everything is working as it should!..for now haha. Thanks again you’ve been a big help :slight_smile:

You can get movement speed by using GetVelocity, but where is GetTurnVelocity or GetLookUpVelocity?

2 Likes

This is great, thanks!