fix(physics): close #77 — auto-walk honors ACE CanCharge bit; zero velocity in turn-in-place
Two related close-range bugs reported in #77 share a root in PlayerMovementController.DriveServerAutoWalk + BeginServerAutoWalk: 1. **Walk-vs-run misclassification.** BeginServerAutoWalk decided `_autoWalkInitiallyRunning = (initialDist - distanceToObject) >= 1.0f`, forcing run at any chase past ~1.6 m. ACE's wire-level walk-vs-run answer is the MovementParameters CanCharge bit (0x10), which Creature.SetWalkRunThreshold sets when server-side player→target distance >= WalkRunThreshold/2 (= 7.5 m default). Retail's MovementParameters::get_command (decomp 0x0052aa00) gates the run path on CanCharge first; the inner walk_run_threshold check practically always walks given ACE's 15 m default. The hardcoded 1.0 m threshold pushed run into the 3-5 m walk-range the user reported should walk. 2. **Velocity leak in turn-in-place phase.** When the auto-walked body crossed the destination, desiredYaw flipped ~180°, walkAligned dropped to false, and the `if (!moveForward) return true;` branch returned without zeroing body velocity. The body kept the prior frame's running velocity (RunAnimSpeed × runRate ≈ 11 m/s) and slid 4-5 m past the target before the turn-around rotation completed — the "runs and slides away, runs back, picks up" symptom in #77 bug B. Changes: - `CreateObject.ServerMotionState.CanCharge`: new bool prop reading bit 0x10 of MoveToParameters. Cross-ref ACE MovementParams.CanCharge = 0x10. - `PlayerMovementController.BeginServerAutoWalk`: replaces the unused `walkRunThreshold` parameter with `bool canCharge`; sets `_autoWalkInitiallyRunning = canCharge`. - `PlayerMovementController.DriveServerAutoWalk` turn-in-place branch: calls `_motion.DoMotion(Ready, 1.0)` and zeros body horizontal velocity (preserving Z for gravity). No-op for case (a) initial-turn with stationary body; fixes (b) overshoot recovery and (c) settling cases. - `GameWindow.OnLiveMotionUpdated`: passes `update.MotionState.CanCharge` through; [autowalk-begin] trace shows `canCharge=` instead of `walkRunThresh=`. - `GameWindow.InstallSpeculativeTurnToTarget`: predicts ACE's CanCharge from local distance using ACE's exact 7.5 m rule, so the speculative install agrees with the wire-triggered overwrite that arrives moments later. Visual-verified at Holtburg 2026-05-18: walk-range NPC click walks + fires Use, walk-range F-key pickup walks + no overshoot, far-range (8-10 m) pickup still runs. Test baseline unchanged (8 Core pre-existing failures, 0 net-new failures across Core/Net/UI/App suites). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
677266d477
commit
3be700020b
3 changed files with 93 additions and 47 deletions
|
|
@ -203,6 +203,28 @@ public static class CreateObject
|
|||
/// </summary>
|
||||
public bool MoveTowards => MoveToParameters.HasValue
|
||||
&& (MoveToParameters.Value & 0x200u) != 0;
|
||||
|
||||
/// <summary>
|
||||
/// MovementParameters bit 4 (mask 0x10) — set when the mover should
|
||||
/// charge (run) rather than walk. ACE's
|
||||
/// <c>Creature.SetWalkRunThreshold</c> sets this when the player-to-
|
||||
/// target distance is at least <c>WalkRunThreshold / 2</c> (7.5 m
|
||||
/// for the 15 m default), and clears it for shorter chases — so this
|
||||
/// bit IS the wire-side walk-vs-run decision.
|
||||
/// <para>
|
||||
/// Retail's <c>MovementParameters::get_command</c>
|
||||
/// (<c>0x0052aa00</c>) gates the run path on this bit: cleared →
|
||||
/// fall through to the inner walk_run_threshold check (which ACE's
|
||||
/// 15 m default + 0.6 m use-radius makes practically always walk for
|
||||
/// any < 15.6 m chase); set → unconditional <c>HoldKey_Run</c>.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Cross-ref: ACE <c>MovementParams.CanCharge = 0x10</c>
|
||||
/// (<c>ACE.Entity/Enum/MovementParams.cs:12</c>).
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public bool CanCharge => MoveToParameters.HasValue
|
||||
&& (MoveToParameters.Value & 0x10u) != 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue