SetShape

Category: Objects
Since engine version: 4.9.1.0 GWE

Description

Changes the bounding rectangle of an object. This rectangle is used e.g. for collision or overlap detection. It does not affect object drawing.

Syntax

bool SetShape (int iX, int iY, int iWdt, int iHgt, object pObj);

Parameters

iX:
X offset of the new shape
iY:
Y offset of the new shape
iWdt:
Width of the new shape
iHgt:
Height of the new shape
pObj:
[opt] Target object. Can be 0 in local calls.

Remark

In various situations the engine will reset the object's shape to the definition value. This might overwrite changes made with SetShape. This will happen e.g. during object rotation but also when resuming a saved game. So this function should only be used for mainly static, unchanging objects and you should readjust the shape manually in synchronization calls like UpdateTransferZone.

Example

SetShape(-200,-300,400,600, FindObject(TRE1));
Enlarges the area or distance from which you can fell a tree.
See also: SetVertex
Sven2, Juni 2003