How to implement Leaning

In this tutorial we will implement leaning mechanic. It works exactly the same way for both Singleplayer and Multiplayer modes.

1. Open the Replicated_Character (or BP_CharacterBase for singleplayer) and add a float variable to it, call it Lean or something along those lines, default value is 0.0

2. Open its TPP AnimBP and read the float rom the character and connect it into the Pitch value

3. Open Replicated_PlayerController (or BP_PlayerController for singleplayer) and recreate this graph

-Create 3 custom events (Lean right, left, reset) that RunOnServer, reliable, input variable is Replicated_Character actor reference (or BP_CharacterBase for singleplayer)
-Create a bool (IsLeaning, default value is false)
-The timelines are the same one copy pasted and it has a float track called alpha (duration 0.20 seconds, max value 1.0)

That’s it!