Skip to main content

flywave-mapview.mapviewutils.raycastworldcoordinates

Home > @flywave/flywave-mapview > MapViewUtils > rayCastWorldCoordinates

MapViewUtils.rayCastWorldCoordinates() function

Casts a ray in NDC space from the current map view and returns the intersection point of that ray wih the map in world space.

Signature:

function rayCastWorldCoordinates(mapView: MapView | {
camera: THREE.Camera;
projection: Projection;
}, pointOnScreenXinNDC: number, pointOnScreenYinNDC: number, elevation?: number): THREE.Vector3 | null;

Parameters

Parameter

Type

Description

mapView

MapView | { camera: THREE.Camera; projection: Projection; }

Instance of MapView.

pointOnScreenXinNDC

number

X coordinate in NDC space.

pointOnScreenYinNDC

number

Y coordinate in NDC space.

elevation

number

(Optional) Optional param used to offset the ground plane. Used when wanting to pan based on a plane at some altitude. Necessary for example when panning with terrain.

Returns:



THREE.Vector3 \| null

Intersection coordinates, or `null` if raycast failed.