Skip to content

Commit

Permalink
Merge pull request #87 from selimnahimi/wallrun-normal-check
Browse files Browse the repository at this point in the history
Update PawnController
  • Loading branch information
selimnahimi authored Sep 8, 2023
2 parents 7bd1ddf + 72a3df8 commit f5159a4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions code/pawn/PawnController.Util.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void InitiateJumpOffWall()

Entity.ApplyAbsoluteImpulse( jumpVector );

previousWallrunSide = Wallrunning;
previousWallrunNormal = CurrentWall.Normal;
Wallrunning = 0;
}

Expand Down Expand Up @@ -104,7 +104,7 @@ void InitiateLandingOnFloor()
AddEvent( "grounded" );

Wallrunning = 0;
previousWallrunSide = 0;
previousWallrunNormal = Vector3.Zero;

parkouredSinceJumping = false;
parkouredBeforeLanding = false;
Expand Down
6 changes: 3 additions & 3 deletions code/pawn/PawnController.Wallrunning.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void UpdateWallrunning()
{
Wallrunning = 0;
wallrunSinceJumping = false;
previousWallrunSide = 0;
previousWallrunNormal = Vector3.Zero;
}

CurrentWall = traceWall.traceResult;
Expand Down Expand Up @@ -87,7 +87,7 @@ bool TryWallrunning( )

var traceWall = CheckForWall();

if ( CanWallrun( traceWall ) && previousWallrunSide != traceWall.side )
if ( CanWallrun( traceWall ) && previousWallrunNormal != traceWall.traceResult.Normal )
{
InitiateWallrun( traceWall );

Expand All @@ -109,7 +109,7 @@ void InitiateWallrun( WallRunTrace traceWall )
}

Wallrunning = traceWall.side;
previousWallrunSide = traceWall.side;
previousWallrunNormal = traceWall.traceResult.Normal;

wallrunSinceJumping = true;
parkouredBeforeLanding = true;
Expand Down
3 changes: 2 additions & 1 deletion code/pawn/PawnController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ public partial class PawnController : EntityComponent<Pawn>
private bool debugMode => false;
private bool parkouredSinceJumping = false;
private bool wallrunSinceJumping = false;
private WallRunSide previousWallrunSide = WallRunSide.None;
// private WallRunSide previousWallrunSide = WallRunSide.None;
private Vector3 previousWallrunNormal = Vector3.Zero;
private bool parkouredBeforeLanding = false;

HashSet<string> ControllerEvents = new( StringComparer.OrdinalIgnoreCase );
Expand Down

0 comments on commit f5159a4

Please sign in to comment.