Download

Rotate inversely towards acceleration

Hi! I’ve created a blueprint script that works similarily to the ”Orient rotation to movement” option for a 3rd person character. Basically it smoothly rotates the character capsule towards it’s acceleration just like I want it to. But since I have strafing and backwards running animations, I don’t want the capsule to always rotate towards acceleration. When moving side I need the capsule to strafe and when moving backwards (including diagonally) I need the capsule to rotate towards acceleration but facing opposite to it, if that makes sense…

Has anyone worked something like that out? Would very much appreciate help.

Maybe you can get the direction and if it’s about -90 or 90 then you know your character is strafing.
Something like this

Amazing! This works as a check. I have a bool for forward/backward input, so if I set it to true/false depending on this it proves it works. But it’s not stable since when I rotate the mouse/gamepad stick it resets and stop strafing. How would I limit the rotation in those cases in a dynamic way that takes mouse rotation into account? If that makes sense?

The way I rotate the actor towards direction of velocity is that I get my last velocity rotation (get velocity + RotationFromXVector → variable: Last Velocity Rotation) and set that as my target in a Rinterp To node with the “current” as my actor rotation, then I set my new target rotation and do another Rinterp with the new target rotation variable as my target and then set actor rotation…

UPDATE: If I do your check and then just simply “Set Actor Rotation” without a new rotation on true (if false I do my rotation towards velocity code)… This works as well. However, it bugs our when rotating mouse/gamepad stick and also does a weird glitch when I quickly go from diagonally forward to strafing and also when I stop strafing it resets the actor rotation to that direction. I guess I need some more check or some relativity to the mouse/camera? Thank you for taking the time!