Download

Orient rotation to movement, but only within a given range?

Is there a way to do this? I’ve got aim offsets that reach from -90 to +90 degrees yaw (i.e. from far left to far right in front of the character). I’ve also got two run loops, a “forward” and a “backward”.

Currently, I use an aim offset which gets the delta between the character and the actor rotation (so that the aim stance is determined by how far the camera is twisted from whatever direction the actor is facing), and this works… but only as long as I’m moving forward relative to the camera (in any direction).

If I try to move backward relative to the camera, the player capsule gets rotated too far (past the 90+ or 90- limit) and the aim offset poses rotate with it. What I’d like to do is limit the ability of the player capsule to rotate to match the direction, so that if I move backwards, the character plays a walking backwards animation instead of rotating. I can do this by disabling “orient rotation to movement” but the problem is this completely blocks out the free rotation of the walk entirely; the player can only walk forward or backward, the legs don’t rotate since the player capsule isn’t turning AT ALL.

What I need to do is orient rotation to movement but with a break between positive Move Forward and negative Move Forward values, so that the capsule can rotate according to the DIRECTION of forward movement but still distinguishes between forward movement and backward movement.

Is this possible?

This is solved; for posterity’s sake, I’ll leave an explanation of my solution.

Essentially, I needed to be able to modify the part of the CharacterMovementComponent which was performing the orient-rotation-to-movement process, but there’s no (apparent) way to do this in Blueprint. So I deactivated the setting in the components view (letting the camera handle all rotation), and then rebuilt the Orient-Rotation-To-Movement functionality manually in my Character blueprint, which allowed me to modify it as I saw fit.

I’ve attached a pic of what I did specifically, and outlined in green the portion of the BP which simply recreates the original functionality (as opposed to the modifications I made to it). If you ever need to change the way this system works (to handle aiming, as I have, or to handle lock-on functionality, or limit input rotation during a dash maneuver, or anything like that where you want partial capsule orientation to movement), you can start from this and tweak it manually.

RebuildingOrientRotationToMovement.jpg

Awesome. Great logic and comments. Thanks a lot dude.