EntityUtils

EntityUtils

Utilities for entity creation etc
Only used to define the class. Should never be instantiated.

Constructor

new EntityUtils()

Methods

(static) clone(world, entity, settingsopt) → {Entity}

Clone entity hierarchy with optional settings for sharing data and callbacks.

Parameters:
Name Type Attributes Description
world World
entity Entity

The entity to clone

settings Object <optional>
Properties
Name Type Attributes Default Description
shareMeshData boolean <optional>
false

Cloning entities clones their mesh data by default

shareMaterials boolean <optional>
false

Cloning entities clones their materials by default

shareUniforms boolean <optional>
false

Cloning entities clones their materials' uniforms by default

shareTextures boolean <optional>
false

Cloning entities clones their materials' textures by default

callback function <optional>

Callback to be run on every new entity. Takes entity as argument. Runs bottom to top in the cloned hierarchy.

Example
var clonedEntity = EntityUtils.clone(world, entity, {
        shareMeshData: false,
        shareMaterials: false,
        shareUniforms: false,
        shareTextures: false
    });

(static) getRoot(entity) → {Entity}

Traverse the entity hierarchy upwards, returning the root entity

Parameters:
Name Type Description
entity Entity

The entity to begin traversing from

(static) getTotalBoundingBox(entity)

Returns the merged bounding box of the entity and its children

Parameters:
Name Type Description
entity