ships.Function.projectGunsight - Elite-Dangerous-Almanac/Almanac-Core GitHub Wiki
@elite-dangerous-almanac/core / ships / projectGunsight
projectGunsight(
gunsight,targetRangeMetres): readonlyGunsightPoint[]
Defined in: src/ships/gunsights.ts:124
Project a gunsight onto a target plane at a chosen range.
Camera-relative hardpoint offsets in metres, normally returned by getShipGunsight.
number
Finite target-plane distance in metres; must be greater than zero.
readonly GunsightPoint[]
One dimensionless angular-tangent point per input offset, preserving its
order. To place a point on a perspective display, divide horizontalTangent and
verticalTangent by the tangent of the corresponding half field of view; invert the
vertical result when screen coordinates increase downwards.
This is fixed, ship-forward geometry. It does not model gimbal or turret tracking, projectile travel, target motion, or head-look.
If targetRangeMetres is not finite and greater than zero.
import {
getShipGunsight,
projectGunsight,
} from '@elite-dangerous-almanac/core/ships/gunsights';
const gunsight = getShipGunsight('SideWinder')!;
projectGunsight(gunsight, 1000)[0];
// -> { horizontalTangent: -0.0021956754, verticalTangent: -0.001166162 }