fix(combat): track targets with retail camera
Port ClientCombatSystem's Keep in View consumer through CameraSet's pivot-to-target boom heading, including the transformed half-metre target offset and melee/missile validity gates. Preserve the existing stateful chase damping and collision architecture, with conformance coverage and named-retail pseudocode. Co-Authored-By: Codex <codex@openai.com>
This commit is contained in:
parent
927fa7881a
commit
33cc9aa16a
5 changed files with 159 additions and 14 deletions
|
|
@ -8415,13 +8415,15 @@ public sealed class GameWindow : IDisposable
|
|||
// player visibly rises in frame without the camera
|
||||
// swinging vertically (was the symptom of using raw
|
||||
// velocity-vector heading).
|
||||
System.Numerics.Vector3? trackedCombatTarget = GetCombatCameraTargetPoint();
|
||||
_retailChaseCamera!.Update(result.RenderPosition, _playerController.Yaw,
|
||||
playerVelocity: _playerController.BodyVelocity,
|
||||
isOnGround: result.IsOnGround,
|
||||
contactPlaneNormal: _playerController.ContactPlane.Normal,
|
||||
dt: (float)dt,
|
||||
cellId: _playerController.CellId,
|
||||
selfEntityId: _playerController.LocalEntityId);
|
||||
selfEntityId: _playerController.LocalEntityId,
|
||||
trackedTargetPoint: trackedCombatTarget);
|
||||
|
||||
// Send outbound movement messages to the live server.
|
||||
if (_liveSession is not null)
|
||||
|
|
@ -12021,6 +12023,26 @@ public sealed class GameWindow : IDisposable
|
|||
return SelectClosestCombatTarget(showToast: false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resolves retail's combat-camera target. ClientCombatSystem::
|
||||
/// UpdateTargetTracking (0x0056A950) enables CameraSet::TrackTarget only
|
||||
/// for melee/missile combat with the option enabled and a valid attack
|
||||
/// target. TrackTarget applies target-local offset (0,0,0.5).
|
||||
/// </summary>
|
||||
private System.Numerics.Vector3? GetCombatCameraTargetPoint()
|
||||
{
|
||||
if (!_persistedGameplay.ViewCombatTarget
|
||||
|| !AcDream.Core.Combat.CombatInputPlanner.SupportsTargetedAttack(Combat.CurrentMode)
|
||||
|| _selection.SelectedObjectId is not uint selected
|
||||
|| !IsLiveCreatureTarget(selected)
|
||||
|| !_entitiesByServerGuid.TryGetValue(selected, out var target))
|
||||
return null;
|
||||
|
||||
return target.Position
|
||||
+ System.Numerics.Vector3.Transform(
|
||||
new System.Numerics.Vector3(0f, 0f, 0.5f), target.Rotation);
|
||||
}
|
||||
|
||||
// ============================================================
|
||||
// Phase B.4b — outbound Use handler. Wires three input actions
|
||||
// (LMB click select, LMB-double-click select+use, R hotkey
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue