EntityManager - stingray.EntityManager namespace reference - Stingray Lua API Reference

stingray.EntityManager namespace reference

Description

Manager for creating and destroying entities.

The EntityManager keeps track of all live entities in the game and can be used to create and destroy entities.

The EntityManager is a singleton (there is only one EntityManager), so you don't need to pass it into the functions. All the functions operate on the EntityManager singleton.

Functions

Parameters

world :

stingray.World

The world whose actor component we should return.

Returns

stingray.ActorComponent

The actor component of the world.

The actor component can be used to add physical actors to entities.

Parameters

entity :

stingray.Entity

The entity to check.

Returns

boolean

Returns true if the entity is alive.

Parameters

world :

stingray.World

The world whose component we should return.

Returns

stingray.AnimationBlenderComponent

The animation blender component of the world.

The animation blender component handles animation blending for entities.

Parameters

world :

stingray.World

The world whose component we should return.

Returns

stingray.AnimationStateMachineComponent

The animation state machine component of the world.

The animation state machine component handles animation state machines for entities.

Parameters

world :

stingray.World?

The world that should own the entity.

The ? notation indicates that this type is optional: there may be zero or one instances of it.
Returns

stingray.Entity

The newly created entity.

If a World is specified, the entity will be owned by that world. The entity will be automatically destroyed when the world is destroyed.

If no world is specified, the entity will live until it is explicitly destroyed by a call to destroy.

Parameters
This function does not accept any parameters.
Returns

stingray.DataComponent

The global data component.

The data component can store blobs of dynamic data for entities.

Parameters

entity :

stingray.Entity

The entity whose name we should check.

Returns

string

The debug name of the entity or "" if no name has been set.

Use set_debug_name to set the name.

Parameters
This function does not accept any parameters.
Returns

stingray.DebugNameComponent

The global debug name component.

The debug name component stores a debug name for each entity.

Parameters

entity :

stingray.Entity

The entity to destroy.

Returns
This function does not return any values.

Destroying an entity also destroys all components owned by the entity.

Parameters

world :

stingray.World

The world whose flow component we should return.

Returns

stingray.FlowComponent

The flow component of the world.

The flow component can be used to assign, trigger, and manipulate flow on entities.

Parameters

world :

stingray.World

The world whose mesh component we should return.

Returns

stingray.MeshComponent

The mesh component of the world.

The mesh component can be used to add graphics meshes to entities.

Parameters

world :

stingray.World

The world whose component we should return.

Returns

stingray.RenderDataComponent

The tag component of the world.

The render data component can store blobs of dynamic data for rendering entities.

Parameters

world :

stingray.World

The world whose actor component we should return.

Returns

stingray.SceneGraphComponent

The scene graph component of the world.

The scene graph component handles scene graphs for entities.

Parameters

world :

stingray.World

The world whose component we should return.

Returns

stingray.ScriptComponent

The script component of the world.

The script component links entities to scripts.

Parameters

entity :

stingray.Entity

The entity whose name should be changed.

name :

string

The name to set for the entity.

Returns
This function does not return any values.

The entity name cannot be longer than 31 characters. Use debug_name to get the name.

Parameters

world :

stingray.World

The world in which the entity should be spawned.

entity_resource :

string

The name of the entity's resource, e.g. "entities/trees/pine".

position :

stingray.Vector3

The position where the entity should be spawned.

orientation :

stingray.Quaternion?

The orientation of the spawned entity. If not specified, the identity orientation is used.

The ? notation indicates that this type is optional: there may be zero or one instances of it.
Returns

stingray.Entity

The newly spawned entity.

Parameters

world :

stingray.World

The world in which the entity should be spawned.

entity_resource :

string

The name of the entity's resource, e.g. "entities/trees/pine".

pose :

stingray.Matrix4x4

The pose of the spawned entity.

Returns

stingray.Entity

The newly spawned entity.

Parameters

world :

stingray.World

The world whose component we should return.

Returns

stingray.TagComponent

The tag component of the world.

The tag component handles tags for entities.

Parameters

world :

stingray.World

The world whose transform component we should return.

Returns

stingray.TransformComponent

The transform component of the world.

The transform component can be used to add transforms to entities.

Parameters

world :

stingray.World

The world whose component we should return.

Returns

stingray.UnitComponent

The unit component of the world.

The unit component links units to entities.