feat: add diagonal ascend/descend moves, fix pitch, smooth look angles

- Add MoveDiagonalAscend and MoveDiagonalDescend for "corner" moves:
  step diagonally around a wall edge while ascending/descending 1 block.
  Requires at least one intermediate cardinal direction to be passable.

- Fix pitch calculation: look toward target's eye level (same height
  delta as feet delta) instead of subtracting eye height, which caused
  the player to stare at the ground during flat walks.

- Add Yaw/Pitch smoothing via SmoothYaw/SmoothPitch in TemplateHelper.
  Max 35 deg/tick for yaw, 25 deg/tick for pitch. Prevents instant
  camera snaps between path segments while still being responsive
  enough for sprint-jumps and tight maneuvers.

- Apply smoothing to all five action templates (Walk, Ascend, Descend,
  Climb, SprintJump).

Made-with: Cursor
This commit is contained in:
BruceChen 2026-04-12 01:15:17 +08:00
parent 399c8cdc79
commit 285c3000c3
9 changed files with 222 additions and 16 deletions

View file

@ -54,19 +54,21 @@ namespace MinecraftClient.Pathing.Execution.Templates
if (_tickCount > 200)
return TemplateState.Failed;
physics.Pitch = TemplateHelper.CalculatePitch(dx, dy - 1.62, dz);
float targetYaw = TemplateHelper.CalculateYaw(dx, dz);
float targetPitch = TemplateHelper.CalculatePitch(dx, dy, dz);
physics.Pitch = TemplateHelper.SmoothPitch(physics.Pitch, targetPitch);
if (physics.OnClimbable)
{
if (horizDistSq > 0.25)
{
physics.Yaw = TemplateHelper.CalculateYaw(dx, dz);
physics.Yaw = TemplateHelper.SmoothYaw(physics.Yaw, targetYaw);
input.Forward = true;
}
}
else if (horizDistSq > 0.01)
{
physics.Yaw = TemplateHelper.CalculateYaw(dx, dz);
physics.Yaw = TemplateHelper.SmoothYaw(physics.Yaw, targetYaw);
input.Forward = true;
}