Okay no problem. Let's break down how the leaning works with the jumping in the video you linked.

Firstly, if the character wasn't moving forwards when they jumped then there wasn't any forward or backward lean. Secondly, if the character jumped while moving forwards, then the forward lean transitioned into a backward lean near the end of the jump. So let's aim to make a jump that will transition from a forward lean to a backward lean if the character was moving forwards when they jumped.

Keep three boolean variables `var going_forward = false`

, `var going_up = false`

, and `var going_down = false`

that you use to keep track of whether the player is going forward, upwards, or downwards.

Set the values every physics cycle

```
if is_zero_approx(Vector2(velocity.x, velocity.z).length()):
going_forward = false
else:
going_forward = true
if is_zero_approx(velocity.y):
going_up = false
going_down = false
else:
if velocity.y > 0:
going_up = true
going_down = false
else:
going_up = false
going_down = true
```

Also keep a constant `const LEAN_ANGLE = PI / 6`

.

Use the booleans to influence the desired lean angle value like this

```
var desired_lean_angle = int(going_forward) * (1 - int(going_up) - 2 * int(going_down)) * LEAN_ANGLE
var desired_quat = Quat(velocity.cross(Vector2(0,1,0)).normalized(), desired_lean_angle)
```

The `desired_lean_angle`

calculation assigns the same value as the following if statements would

```
if not going_forward:
desired_lean_angle = 0.0
else:
if going_up:
desired_lean_angle = 0.0
elif going_down:
desired_lean_angle = -LEAN_ANGLE
else:
desired_lean_angle = LEAN_ANGLE
```

One issue with this is that it will jerk into the backwards lean near the top of the jump. I suppose a more advanced approach would be to make the animations for the forward movement and the jump/fall separately, and then blend them together using the various animation nodes available in Godot. But I'm not sure how to do that.