createBuilding Method

Creates a new building object on the terrain.

createBuilding(vertices, roofHeight, [name], [heightType]);

 

Parameter

Description

vertices

An array of  SGCoord3D, SGCoord2D, SGPosition or numbers. If the array is composed of numbers, they must be as follows: x1, h1, y1, x2, h2, y2…

roofHeight

The height of the building’s roof

name

Optional

The node name

heightType

Optional, default: sgHeightRelative

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 building, access the node innerObj. See SGNode.innerObj property and ITerrainBuilding5 interface for more details.