Instructs the camera to fly to a point of interest in a specific pattern.
flyTo(obj,[pattern]);
Parameter |
Description |
obj |
Can be one of the following: SGPosition, SGCoord3D, SGCoord2D, SGNode, nodeId or an array of each of the above |
pattern |
Optional, default: sgPatternFlyto Can be one of the following: sgPatternFlyto, sgPatternJump, sgPatternCircle, sgPatternOval, sgPatternLine, sgPatternArc |
Remarks
When flying to an object, the camera’s position in relation to the object when it stops, depends on several factors:
If the obj parameter is SGCoord2D or SGCoord3D the camera stops at a distance of 500 meters from the specified coordinate (and looking towards it).
If the obj parameter is SGPosition, the distance and angles from the specified coordinates are determined by the SGPosition properties yaw, pitch and distance.
If the obj parameter is SGNode or a node id, and the node represents a group, the method tries to determine where to fly by examining the position of the objects inside the group.
If obj parameter is an array, the camera will fly to the center of the array bounding box.
Example
The following examples illustrate the use of the flyTo method.
function flyToCoordinate()
{
var Vermont = new SGCoord3D(-72.75206, 43.91127, 30000);
globe.navigate.flyTo(Vermont);
}
function flyToObject()
{
var pivot = new SGCoord3D(-71.07542, 42.37000, 70);
var box = globe.creator.createBox(pivot,
50, // box width
50, // box depth
80); // box height
globe.navigate.flyTo(box, sgPatternCircle);
}
function flyToNewEngland()
{
var Vermont = new SGCoord2D(-72.75206, 43.91127);
var NewHampshire = new SGCoord2D(-71.61263, 43.56527);
var Maine = new SGCoord2D(-69.40414, 45.12594);
var Massachusetts = new SGCoord2D(-71.88455, 42.34216);
var RhodeIsland = new SGCoord2D(-71.57073, 41.62953);
var Connecticut = new SGCoord2D(-72.64295, 41.57912);
globe.navigate.flyTo([Vermont, NewHampshire, Maine, Massachusetts, RhodeIsland, Connecticut]);
}