Sets the position of the camera in the 3D World. Unlike MovePosition() this method “jumps” to the specified position meaning, it is a little more expansive (performance-wise) than MovePosition(). However, SetPosition() ensures that the terrain block mechanism retrieves more accurate blocks at the new position. Use this method when you want to jump to a new location on the terrain rather than updating the current position (as part of a motion).
HRESULT SetPosition(
[in] double X,
[in] double Y,
[in] double Height,
[in] double Yaw,
[in] double Pitch,
[in] double Roll,
[in] double CameraDeltaYaw,
[in] double CameraDeltaPitch,
[in, defaultvalue(0)] long Flags)
Parameters:
X – The West-East coordinate of the camera position represented in MPT units. You can use the ITerrain interface to retrieve information about the MPT units. If you are working in a Lat-Long format, the Lat-Long values are in decimal Lat-Long.
Y – The North-South coordinate of the camera position represented in MPT units. You can use the ITerrain interface to retrieve information about the MPT units. If you are working in a Lat-Long format, the Lat-Long values are in decimal Lat-Long.
Height – The height of the camera, in meters.
Yaw – The Yaw angle of the plane. See: “Yaw, Pitch and Roll Angles”.
Pitch – The Pitch angle of the plane. See: “Yaw, Pitch and Roll Angles”.
Roll – The Roll angle of the plane. See: “Yaw, Pitch and Roll Angles”.
CameraDeltaYaw – The offset
between the plane yaw and the camera yaw.
See: “Camera and
Plane”.
CameraDeltaPitch – The
offset between the plane pitch and the camera pitch.
See: “Camera and
Plane”.
Flags – Determine how the X, Y, Height, Yaw, Pitch and Roll parameters are interpreted. If this flag has a zero value, these parameters are interpreted as indicated in absolute world coordinates. Alternatively, this parameter can contain any combination of the following flags:
IGNORE_X = 1
The X parameter is ignored – In this case, the current X-coordinate
of the plane is not changed.
IGNORE_HEIGHT = 2
The Height parameter is ignored – In this case, the current Height
of the plane is not changed.
IGNORE_Y = 4
The Y parameter is ignored – In this case, the current Y-coordinate
of the plane is not changed.
IGNORE_POSITION = 7
This flag is a combination of IGNORE_X, IGNORE_HEIGHT and IGNORE_Y
and is indicating that the position of the plane in the world is
not changed by this method call.
IGNORE_YAW = 8
The Yaw parameter is ignored – In this case, the current Yaw
orientation of the plane is not changed.
IGNORE_PITCH = 16
The Pitch parameter is ignored – In this case, the current Pitch
orientation of the plane is not changed.
IGNORE_ROLL = 32
The Roll parameter is ignored – In this case, the current Roll
orientation of the plane is not changed.
IGNORE_ORIENTATION = 56
This flag is a combination of IGNORE_YAW, IGNORE_PITCH, IGNORE_ROLL
and indicates that the orientation of the plane in the world is not
hanged by this method call.
NEW_ELEVATION_RELATIVE_TO_CURRENT_ELEVATION
= 64
When set, this flag indicates that the Height parameter should be
used as an offset from the current height of the plane.
NEW_POS_RELATIVE_TO_CURRENT_POS =
128
When set, this flag indicates the X and Y parameters (in meters)
that should be used as an offset from the current plane
position.
NEW_ANGLES_RELATIVE_TO_CURRENT_ANGLES = 256
When set, this flag indicates that the Yaw, Pitch and Roll
parameters should be used as an offset from the current plane
orientation.
IGNORE_CAMERA_YAW = 1024
The CameraDeltaYaw parameter is ignored – In this case, the current
CameraDeltaYaw offset of the camera is not changed.
IGNORE_CAMERA_PITCH =
2048
The CameraDeltaPitch parameter is ignored – In this case, the
current CameraDeltaPitch offset of the camera is not changed.
Return Values:
The return value obtained from the returned HRESULT can be one of the following:
Return value |
Meaning |
S_OK |
Success. |
E_FAIL |
Catastrophic failure. |
TE_E_MPTNOTLOADED |
An MPT file must be loaded in TerraExplorer for this method to work. |