Skip to content

Commit

Permalink
Update jumping logic
Browse files Browse the repository at this point in the history
- Added Jumping field to PawnController
- Renamed animparam: "jumping" to "airborne"
- Added "jumping" animparam to indicate that the player initiated the jumping

This will result in a falling animation playing when falling off a ledge, instead of jumping.
  • Loading branch information
selimnahimi committed Sep 8, 2023
1 parent 7c3f05d commit 7523770
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 2 deletions.
42 changes: 41 additions & 1 deletion animgraphs/faith_arms.vanmgrph
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,19 @@
m_data = 10.0
}
},
{
_class = "CParameterAnimCondition"
m_comparisonOp = 0
m_paramID =
{
m_id = 1226064506
}
m_comparisonValue =
{
m_nType = 1
m_data = true
}
},
]
m_blendDuration = 0.2
m_destState =
Expand Down Expand Up @@ -273,6 +286,19 @@
m_data = 10.0
}
},
{
_class = "CParameterAnimCondition"
m_comparisonOp = 0
m_paramID =
{
m_id = 1226064506
}
m_comparisonValue =
{
m_nType = 1
m_data = false
}
},
]
m_blendDuration = 0.2
m_destState =
Expand Down Expand Up @@ -2712,7 +2738,7 @@
},
{
_class = "CBoolAnimParameter"
m_name = "jumping"
m_name = "airborne"
m_id =
{
m_id = 1731058928
Expand Down Expand Up @@ -2836,6 +2862,20 @@
m_fMaxValue = 1000.0
m_bInterpolate = false
},
{
_class = "CBoolAnimParameter"
m_name = "jumping"
m_id =
{
m_id = 1226064506
}
m_previewButton = "ANIMPARAM_BUTTON_NONE"
m_bNetwork = true
m_bUseMostRecentValue = false
m_bAutoReset = false
m_bPredicted = false
m_bDefaultValue = false
},
]
}
m_pTagManager =
Expand Down
3 changes: 2 additions & 1 deletion code/pawn/Pawn.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,8 @@ void UpdateAnimParameters()
{
SetAnimParameter( "speed", Velocity.Length );
SetAnimParameter( "horizontal_speed", Velocity.WithZ(0).Length );
SetAnimParameter( "jumping", !Controller.Grounded );
SetAnimParameter( "airborne", !Controller.Grounded );
SetAnimParameter( "jumping", Controller.Jumping );
SetAnimParameter( "dashing", Controller.Dashing );
SetAnimParameter( "wallrunning", (int)Controller.Wallrunning );
SetAnimParameter( "vaulting", (int)Controller.Vaulting );
Expand Down
3 changes: 3 additions & 0 deletions code/pawn/PawnController.Util.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@ void InitiateLandingOnFloor()
parkouredSinceJumping = false;
parkouredBeforeLanding = false;

Jumping = false;

if ( Entity.Velocity.Length > 100f )
{
CurrentMaxSpeed += 500;
Expand Down Expand Up @@ -238,6 +240,7 @@ void InitiateJump()
{
if ( CanJump() )
{
Jumping = true;
Entity.Velocity = ApplyJump( Entity.Velocity, "jump" );
}
}
Expand Down
1 change: 1 addition & 0 deletions code/pawn/PawnController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public partial class PawnController : EntityComponent<Pawn>
public float TimeSinceClimbing { get; set; }
public float TimeSinceWallrun { get; set; }
public TraceResult CurrentWall { get; set; } = new TraceResult();
public bool Jumping { get; set; }

private int CurrentClimbAmount { get; set; }
public float CurrentMaxSpeed { get; set; }
Expand Down

0 comments on commit 7523770

Please sign in to comment.