Skip to content

Commit

Permalink
View bobbing scales with player hitbox height
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexDavies8 committed Sep 12, 2024
1 parent 1e7794d commit eaee832
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/game.zig
Original file line number Diff line number Diff line change
Expand Up @@ -781,8 +781,8 @@ pub fn update(deltaTime: f64) void { // MARK: update()
if (Player.onGround) { // No view bobbing in the air
Player.bobTime += Player.bobVel * 8 * deltaTime;
}
// Maximum magnitude when sprinting (2x walking speed)
Player.bobMag = @sqrt(@min(Player.bobVel, 2)) * settings.viewBobStrength;
// Maximum magnitude when sprinting (2x walking speed). Magnitude is scaled by player bounding box height
Player.bobMag = @sqrt(@min(Player.bobVel, 2)) * settings.viewBobStrength * Player.outerBoundingBoxExtent[2];
}

// This our model for movement on a single frame:
Expand Down

0 comments on commit eaee832

Please sign in to comment.