createDynamic Method

Creates a new dynamic object that moves in a predefined path on the terrain.

createDynamic(waypoints, [motionStyle], [objectType], [filenameOrText], [scale], [name], [heightType]);

 

Parameter

Description

waypoints

Array of SGWaypoint

motionStyle

Optional, default: sgMotionStyleAirplane

Can be one of the following:

sgMotionStyleGroundVehicle - The object is a ground vehicle

sgMotionStyleAirplane - The object sets the pitch angles during the flight according to altitude differences between the waypoints. It also rolls while turning between the waypoints

sgMotionStyleHelicopter - The object leans forward with a fixed pitch angle of  –15 degrees. It also rolls while turning between the waypoints.

sgMotionStyleHovercraft - The object always keeps the pitch and roll angels set to zero

objectType

Optional, default: sgDynamicObjectTypeVirtual

Can be one of the following:

sgDynamicObjectTypeModel - A 3D model is used

sgDynamicObjectTypeText - A text label is used

sgDynamicObjectTypeImage - An image label is used

sgDynamicObjectTypeVirtual - A virtual type is used, any object can be attached to the virtual dynamic object

filenameOrText

Optional

If objectType is sgDynamicObjectTypeText, this parameter contains text; otherwise, it is a filename URL.

scale

Optional

The object dimensions in meters per pixel

name

Optional

The node name

heightType

Optional, default: sgHeightAbsolute

The height type of the object

Can be sgHeightRelative, or sgHeightAbsolute

Return Value

An SGNode object. If the method fails, the return value is null. SGWorld.lastError will contain the failure reason.

Remarks

To modify other properties of the dynamic object, access the node innerObj. See SGNode.innerObj property and ITerrainDynamicObject5 interface for more details.