Home > @magiclane/maps-sdk > MapCamera > setCameraRelativeToTarget

MapCamera.setCameraRelativeToTarget() method

Sets the camera relative to a target position, looking in any direction relative to the direction toward the target, all in the coordinate system of the focused target.

This function is the same as setCameraRelativeToCenteredTarget, except the camera can be oriented in a direction other than centered on the target.

The camera is centered on the target when the 4th parameter, the camera/observer heading, pitch, roll = 0, 0, 0. A nonzero heading, in degrees, specifies a rotation about the observer/camera up axis, going through the observer/camera position. A nonzero pitch, in degrees, specifies a rotation about the observer/camera right axis, going through the observer/camera position. A nonzero roll, in degrees, specifies a rotation about the observer/camera forward vector.

Signature:

setCameraRelativeToTarget(targetCoords: Coordinates, targetHeadingPitchRollDeg: Point3d, cameraHeadingPitchDegDistanceMeters: Point3d, cameraHeadingPitchRollDeg: Point3d): void;

Parameters

Parameter

Type

Description

targetCoords

Coordinates

Coordinates representing the desired latitude, longitude and altitude.

targetHeadingPitchRollDeg

Point3d

Point3d representing the desired heading, pitch and roll.

cameraHeadingPitchDegDistanceMeters

Point3d

Point3d representing the desired heading, pitch and distance.

cameraHeadingPitchRollDeg

Point3d

Point3d representing the desired heading, pitch and roll for camera.

Returns:

void

Exceptions

An exception if it fails.