fix: leaving wall stops wall hugging

This commit is contained in:
2025-06-10 16:53:09 +02:00
parent f00def5e6e
commit d53aca98a0
5 changed files with 22 additions and 1 deletions

View File

@ -181,6 +181,8 @@ public partial class PlayerController : CharacterBody3D
_grounded.StatePhysicsProcessing += HandleGrounded;
_airborne.StatePhysicsProcessing += HandleAirborne;
_wallHugging.StatePhysicsProcessing += HandleWallHugging;
_coyoteEnabled.StateEntered += StartCoyoteTime;
_coyoteTimer.Timeout += CoyoteExpired;
_jump.StateEntered += Jump;
@ -383,6 +385,12 @@ public partial class PlayerController : CharacterBody3D
_playerState.SendEvent("wall_hug");
}
public void HandleWallHugging(float delta)
{
if (!WallHugSystem.IsWallHugging())
_playerState.SendEvent("start_falling");
}
///////////////////////////
// Stateless logic ////////
///////////////////////////