Camera rotation using axis value for character lean


I’m working on a peak/lean feature for a first-person character that essentially moves and rotates the camera from its base location to a set amount using the absolute value of the input axis (MoveRight in this case) as an alpha value. Essentially, this gives the player control over how much their character leans one direction or the other.

I have the camera positioning working correctly, but I would like to introduce a slight camera rotation that functions essentially the same way. Using SetRelativeRotation on the camera component doesn’t work, and I had issues using Add Controller Roll Input (which I suspect I will need to use, I just can’t figure out how to limit the rotation to the input axis value). Current Blueprint attached.

Any ideas on how I can achieve this?

If I understood your problem correctly, set your initial rotation in a variable, and in your tick event check that current rotation differs by X amount (value to limit rotation), if it increases that amount then disable your “CanMove” boolean.