Weapon crosshairs ride the gravity field: the aim point takes its own field height, not the ship's level plane
On a slope the level projection floated over downhill aim and sank into uphill aim (operator report, 2026-10-29). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
293e3a33fd
commit
a9bbea5091
1 changed files with 5 additions and 0 deletions
|
|
@ -1435,12 +1435,17 @@ public class ActionGameManager : MonoBehaviour
|
||||||
else if (target.Entity != null)
|
else if (target.Entity != null)
|
||||||
TargetIndicator.Target = DrawAhead.Position(target.Entity, lead).ToUnity();
|
TargetIndicator.Target = DrawAhead.Position(target.Entity, lead).ToUnity();
|
||||||
var distance = length(ViewDot.Target.ToCultMath() - ownDrawn);
|
var distance = length(ViewDot.Target.ToCultMath() - ownDrawn);
|
||||||
|
var ownField = DrawAhead.Height(CurrentEntity.Zone, ownDrawn.xz, lead);
|
||||||
foreach (var (_, barrels, crosshair) in _articulationGroups)
|
foreach (var (_, barrels, crosshair) in _articulationGroups)
|
||||||
{
|
{
|
||||||
var averagePosition = Vector3.zero;
|
var averagePosition = Vector3.zero;
|
||||||
foreach (var barrel in barrels)
|
foreach (var barrel in barrels)
|
||||||
averagePosition += barrel.position + barrel.forward * distance;
|
averagePosition += barrel.position + barrel.forward * distance;
|
||||||
averagePosition /= barrels.Length;
|
averagePosition /= barrels.Length;
|
||||||
|
// Shots fly over the field, so the crosshair rides it too: the aim point's own field height, plus the barrels' height
|
||||||
|
// above the field under the ship. A level projection floats over downhill aim and sinks into uphill aim.
|
||||||
|
var aimPlanar = float2(averagePosition.x, averagePosition.z);
|
||||||
|
averagePosition.y += DrawAhead.Height(CurrentEntity.Zone, aimPlanar, lead) - ownField;
|
||||||
crosshair.Target = averagePosition;
|
crosshair.Target = averagePosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue