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 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.
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.