Navigating in the 3D World

This example shows how to get the Camera position, set the Camera position and fly to specific coordinates in the 3D World using the IPlane5 interface.

 

<HTML>

 

<b>IPlane5 sample</b></br>

This code uses the following IPlane5 interface methods: GetPosition(), SetPosition() and FlyTo()</br></br>

 

<SCRIPT Language="VBSCRIPT">

 

sub GetPosition()

Set IPlane5 = TE.interface("IPlane5")

IPlane5.GetPosition X, Y, Height, Yaw, Pitch, Roll, CameraDeltaYaw, CameraDeltaPitch

 

'At this point, we have the plane position.

'Do something with it (i.e. connect to a server to find the nearest movie theater).

'In this sample, simply display it in a message box.

 

Msgbox "Plane position: " & X & "," & Y & "," & Height

Msgbox "Plane orientation: " & Yaw & "," & Pitch & "," & Roll

Msgbox "Camera offset: " & CameraDeltaYaw & "," & CameraDeltaPitch

end sub

 

sub SetPosition()

Set IPlane5 = TE.interface("IPlane5")

IPlane5.GetPosition X, Y, Height, Yaw, Pitch, Roll, CameraDeltaYaw, CameraDeltaPitch

 

'The following SetPosition jumps the plane 1 kilometer in each axis while keeping the

   ' same orientation. The last argument (3320) is the combination of the following flags:

'NEW_ELEVATION_RELATIVE_TO_CURRENT_ELEVATION |

'NEW_POS_RELATIVE_TO_CURRENT_POS | IGNORE_ORIENTATION |

'IGNORE_CAMERA_YAW | IGNORE_CAMERA_PITCH.

IPlane5.SetPosition 1000, 1000, 1000, 0, 0, 0, 0, 0, 3320

end sub

 

sub FlyTo()

Set IPlane5 = TE.interface("IPlane5")

 

'The following statement causes TE to fly to coordinate 946672.31, 2113310.65, 2000

'and to stop 100 meters from that location.

IPlane5.FlyTo 946672.31, 2113310.65, 2000, 100, 0, 0, "FlyToTerrain"

end sub

 

</SCRIPT>

 

<INPUT type=button value="GetPosition" name="GetPosition" onclick="GetPosition()"></br>

<INPUT type=button value="SetPosition" name="SetPosition" onclick="SetPosition()"></br>

<INPUT type=button value="FlyTo" name="FlyTo" onclick="FlyTo()">

 

<BODY>

<OBJECT ID="TE" CLASSID="CLSID:3a4f9191-65a8-11d5-85c1-0001023952c1" ></OBJECT>

</BODY>

</HTML>