I’m having trouble limiting my character’s movement when sprinting. I want the character to have limited motion when at full sprint, only allowing for slight slow turns and slower camera movement.
Thinking about it Gears of War’s Roadie Run (Sprint) is exactly this. So maybe a CameraAnim, but how would I go about limiting the player movement?
I’m having trouble with the same thing - I know that the key is to branch on your sprinting boolean during InputAxis MoveRight. If sprinting is false, add movement input and controller yaw input like normal. If true, replace the side-to-side movement input with restricted camera yaw input. The only way I could figure out how to do this is by adding controller yaw input that’s 1/3 as sensitive as the camera’s and simply setting forward movement to 1 when the character is moving in any direction while the sprint button is held.
You’ll notice (if you can find your way through the tangle) that I also added the “1/3 controller yaw input” described above to the regular non-sprinting controls. I did that just because. It looks more like a normal third-person game that way, I think (character orbits camera when moving right or left). But adding controller yaw input and setting the forward vector’s movement input to either 1 or 0 worked for me, in conjunction with my other (unshown) blueprint for setting the character’s max walk speed when the sprint button is held.
While this works, it does not look like clean logic to me. Does anyone know a better way to do this?
You actually just need to FinterpTo the input axis for both forward/right
The interpSpeed becomes the speed at which you turn, you can map a range based on the velocity of your pawn to increase/decrease your turn rate based on how fast you’re moving.
I tried both clamped and unclamped. Go with clamped! Unclamped will have you reach neagative interp values pretty quick so if you want vastly different ranges for tiers of speed you’ll need to break that up with branch bools either to set dynamic ranges by setting variables or by just copy pasting all the code for each bracket of speed.
Using the camera to damp turning will give you a lot of restrictions in the future. Don’t forget to divide the scale value by delta time.