setPosition Method

Sets the camera’s position and orientation.

setPosition(pos);

 

Parameter

Description

pos

An SGPosition object

Remarks

There is no need to set all the properties of the SGPosition object when calling setPosition. If one of the properties of the SGPosition is null or undefined, it is ignored when setting the camera’s position. For example, leaving the x property undefined while setting the y property will move the camera along the y axis only.

To set the height of the camera above the ground, the user must make sure that the heightType property of the SGPosition is set to sgHeightRelative, otherwise he must set it to sgHeightAbsolute.

The roll property of the SGPosition object is ignored.

Example

The following example illustrates the use of the setPosition method.

 

function setCameraPosition()

{

   var pos = new SGPosition(-71.05216, // X

                             42.34569, // Y

                             1000.0,   // Height in meters

                             0.0,      // Yaw

                            -43.0);    // Pitch

           

   globe.navigate.setPosition(pos);

}