Constructors

SceneObjectGroup

Constructor Summary

SceneObjectGroup

A SceneObjectGroup is an array of SceneObjects with some extra properties in addition to the usual Array ones. It allows you to manipulate several objects at once. In addition to the methods listed in the SceneObjectGroup documentation, you can call any SceneObject functions on a SceneObjectGroup.

Functions Summary

SceneObjectGroup.getGroupBoundingBox ()

Get an axis-aligned bounding-box (in world space) that contains all the objects in the group

SceneObjectGroup.getGroupCenter ()

Get the center of the group in world space

SceneObjectGroup.getGroupScreenBoundingBox ()

Get an axis-aligned bounding-box (in screen space) that contains all the objects in the group

SceneObjectGroup.getGroupSize ()

Get the size of the group in world space

SceneObjectGroup.getName ()

Get the current name of the group

SceneObjectGroup.isInScene ()

Check whether the scene object group is currently in the scene

SceneObjectGroup.rotateGroup (rotation)

Rotate all the objects in the group around the group center

SceneObjectGroup.serialize (stringify)

Create a JSON object representing this SceneObjectGroup. A new SceneObjectGroup can then be created by passing this JSON object into the SceneObjectGroup constructor

SceneObjectGroup.setGroupCenter (positionX, positionY)

Set the center position of the group in world space

SceneObjectGroup.setName (name)

Change the name of the SceneObjectGroup. Although you can have multiple groups with the same name, try to use unique names to avoid ambiguous results when getting groups by name.

SceneObjectGroup.translateGroup (deltaX, deltaY)

Translate (shift) the group in world space

Constructor Details

SceneObjectGroup

A SceneObjectGroup is an array of SceneObjects with some extra properties in addition to the usual Array ones. It allows you to manipulate several objects at once. In addition, the methods listed in the SceneObjectGroup documentation, you can call any SceneObject functions on a SceneObjectGroup.

array|object This : parameter can be either an array of SceneObject or an object with the following fields:

sceneObjectNames: an array of scene object names

name: a string defining the name of the group

Function Details

SceneObjectGroup.getGroupBoundingBox ()

Get an axis-aligned bounding-box (in world space) that contains all the objects in the group

Returns {minX: number, minY: number, maxX: number, maxY: number} : The bounding box

SceneObjectGroup.getGroupCenter ()

Get the center of the group in world space

Returns {x: number, y: number} : The coordinates of the center point

SceneObjectGroup.getGroupScreenBoundingBox ()

Get an axis-aligned bounding-box (in screen space) that contains all the objects in the group

Returns {minX: number, minY: number, maxX: number, maxY: number} : The bounding box

SceneObjectGroup.getGroupSize ()

Get the size of the group in world space

Returns {x: number, y: number} : The size of the group

SceneObjectGroup.getName ()

Get the current name of the group

Returns string : The name of the SceneObjectGroup

SceneObjectGroup.isInScene ()

Check whether the scene object group is currently in the scene

Returns boolean : Whether the scene object group is currently in the scene

SceneObjectGroup.rotateGroup (rotation)

Rotate all the objects in the group around the group center

number rotation (optional): The rotation amount, in radians

SceneObjectGroup.serialize (stringify)

boolean stringify (optional): Whether this function should return a string representation of the object

Returns object|string : A data object representing this SceneObjectGroup

SceneObjectGroup.setGroupCenter (positionX, positionY)

Set the center position of the group in world space

number|object positionX : The position along the X axis. You can also use an object with x and y fields, omitting the second parameter.

number positionY (optional): The position along the Y axis

SceneObjectGroup.setName (name)

string name : The new name

SceneObjectGroup.translateGroup (deltaX, deltaY)

Translate (shift) the group in world space

number|object deltaX : How much to move the object horizontally. You can also use an object with x and y fields, omitting the second parameter.

number deltaY (optional): How much to move the object vertically.