Need help calculating spine rotation (transform bone) for Left/Right Leaning

I’m trying to set up an event based lean/peak where on input the character leans left/right. I just need to figure out how to calculate the spine rotation. The rotation value is being applied to spine 1,2 and 3.

For simplicity I set a test var: If Left (0,-10, 0) … if Right (0,10,0). It works fine for the most part, but when facing certain directions the lean goes up/down.

I’m also using an aim offset (blendspace).

I’ll probably make a tutorial on this. Are you in first person or 3rd? or true first person?

True First Person.

I think I got it figured out. I went back to my original approach and just changed the order of events in the anim graph … state machine → lean → AO → IK

Seems to be working correctly.

I’m using a timeline -> Lerp (Rotator) -> set “Lean Rotation” (rot) in character bp. Then I fetch it and apply it to the bone transform (spine 1,2,3)

makes sense. but the timeline could possibly cause issues.
Also make sure you cannot over-rotate by tapping the key.
Should work fine though.

You could possibly get a better result by using Apply Percentage Of Rotation.
Set the head to the full rotation, work down the neck_01, spine_03, spine_02, spine_01 with varying percentages instead of using the same rotation.

on key release the lean reverts using reverse timeline. tapping never exceeds the intended max…as far as I can tell by debug print out.

I’m currently using the iron sights anim to stip the head lean.

Only issue I’m having is with getting a jiggle lean to work. I have to wait for the lean to revert fully before starting the opposite lean.

https://cdn.discordapp.com/attachments/377600186257637398/685972969180102658/unknown.png

https://cdn.discordapp.com/attachments/377600186257637398/685973488917544973/unknown.png

force stop the update if the opposite key is pressed - via a boolean. If it ever tests True you run the same code as Finished.
IT might snap, it may not. since the lerp to is already taking place.

I’m thinking about passing the current timeline state over to the other lean … adding to it so to speak. So if left is at 50% on release and then right is keyed I’ll pass the remaining time over and add it to rights time. Then on lerp rotator I’ll set the “a pin” to lefts current. Theoretically it seems sound.