getPosition Method

Returns the camera’s current position and orientation.

getPosition([heightType]);

 

Parameter

Description

heightType

Optional, default: sgHeightRelative

Can be sgHeightRelative or sgHeightAbsolute

Return Value

An SGPosition object that represents the camera’s current position and orientation in the 3D world.

Remarks

The height property of the returned SGPosition  object is affected by the heightType parameter. The default behavior is to return the height of the camera above ground level. To get the absolute height of the camera, select sgHeightAbsolute as heightType

Example

The following example illustrates the use of the getPosition method.

 

function displayCameraPosition()

{

   var pos = globe.navigate.getPosition();

   alert("Current Position:\n\nX: " + pos.x + "\nY: " + pos.y + "\nHeight: " + pos.height + "\nYaw: " + pos.yaw + "\nPitch: " + pos.pitch);

}