Returns an SGPosition object that represents the same position as the caller’s coordinates and the angles that are directed toward the given coordinates.
aimTo(coord);
Parameter |
Description |
coord |
Can be SGCoord2D, SGCoord3D or SGPosition |
Return Value
Returns an SGPosition object that represents the same position as the caller’s coordinates and the angles that are directed toward the given coordinates.
Remarks
This method is in many cases useful when calculating a three-dimensional movement by combining several calls to coordinate method in the following way:
var myNewPos = myCurrentPos.move(1000,0).aimTo(objectOfInterest);
globe.navigate.setPosition(myNewPos);
In the above example, a position object is created by moving a coordinate 1km to the north while making it look toward the object of interest on the terrain.