Skip to content

ships.Function.projectGunsight

github-actions[bot] edited this page Aug 26, 2026 · 65 revisions

@elite-dangerous-almanac/core / ships / projectGunsight

Function: projectGunsight()

projectGunsight(gunsight, targetRangeMetres): readonly GunsightPoint[]

Defined in: src/ships/gunsights.ts:124

Project a gunsight onto a target plane at a chosen range.

Parameters

gunsight

ShipGunsight

Camera-relative hardpoint offsets in metres, normally returned by getShipGunsight.

targetRangeMetres

number

Finite target-plane distance in metres; must be greater than zero.

Returns

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.

Remarks

This is fixed, ship-forward geometry. It does not model gimbal or turret tracking, projectile travel, target motion, or head-look.

Throws

If targetRangeMetres is not finite and greater than zero.

Example

import {
  getShipGunsight,
  projectGunsight,
} from '@elite-dangerous-almanac/core/ships/gunsights';

const gunsight = getShipGunsight('SideWinder')!;
projectGunsight(gunsight, 1000)[0];
// -> { horizontalTangent: -0.0021956754475, verticalTangent: -0.001166162014 }

API

Guides
astro
Classes (1)
ProceduralSystem

Properties

Accessors

Methods

Interfaces (16)
Type Aliases (3)
Variables (11)
Functions (37)
Subpath modules (3)
commodities
Interfaces (1)
Type Aliases (1)
Variables (3)
Functions (3)
equipment
Interfaces (6)
Type Aliases (8)
Variables (3)
Functions (10)
Subpath modules (2)
i18n
Interfaces (1)
Type Aliases (1)
Functions (17)
materials
Enumerations (2)
Interfaces (2)
Type Aliases (2)
Variables (9)
Functions (9)
ships
Classes (3)
BuildMetrics

Methods

LoadoutEditError

Constructors

Properties

Methods

ShipLoadout

Accessors

Methods

Interfaces (125)
Type Aliases (44)
Variables (10)
Functions (85)
Subpath modules (8)

Clone this wiki locally