SceneGraphComponent - stingray.SceneGraphComponent object reference - Stingray Lua API Reference

stingray.SceneGraphComponent object reference

Description

A component that assigns a scene graph (node hierarchy) to an entity.

The scene graph is used for animating and skinning the entity.

Functions

Parameters

self :

stingray.SceneGraphComponent

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

entity :

stingray.Entity

The entity.

id :

any(integer, string)

The component id.

The any(...) notation indicates that this item may be an instance of any of the types shown in the parentheses.
Returns

integer

The component instance.

Parameters

self :

stingray.SceneGraphComponent

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

instance :

integer

The component instance to destroy.

Returns
This function does not return any values.
Parameters

self :

stingray.SceneGraphComponent

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

entity :

stingray.Entity

The entity to destroy all component instances for.

Returns
This function does not return any values.
Parameters

self :

stingray.SceneGraphComponent

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

instance :

integer

The component instance.

key :

any(string, string[])

The key for the property whose value you want to get.

The any(...) notation indicates that this item may be an instance of any of the types shown in the parentheses.
Returns

any*

The value of the key.

The * notation indicates that there may be zero or more instances of the specified type.

The key can either be a dot separated string "fog.color.red" or an array of strings {"fog", "color", "red"}. Both methods can be used interchangeably.

The value will be one of the values supported by the property system: nil, boolean, number, string or an array of floats.

Float arrays are returned as multiple return values. Use a wrapper if you want them as a table or a Vector3.

If the key doesn't exist, nil will be returned.

Parameters

self :

stingray.SceneGraphComponent

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

entity :

stingray.Entity

The entity.

id :

integer

The component instance id.

key :

any(string, string[])

The key for the property whose value you want to get.

The any(...) notation indicates that this item may be an instance of any of the types shown in the parentheses.
Returns

any*

The value of the key.

The * notation indicates that there may be zero or more instances of the specified type.

The key can either be a dot separated string "fog.color.red" or an array of strings {"fog", "color", "red"}. Both methods can be used interchangeably.

The value will be one of the values supported by the property system: nil, boolean, number, string or an array of floats.

Float arrays are returned as multiple return values. Use a wrapper if you want them as a table or a Vector3.

If the key doesn't exist, nil will be returned.

Calling this function will do an additional lookup from the specified component id to component instance. When getting multiple properties it is better to to first lookup the component instance with the component id and then call get_property.

Parameters

self :

stingray.SceneGraphComponent

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

entity :

stingray.Entity

The entity.

Returns

integer*

All entity component instances.

The * notation indicates that there may be zero or more instances of the specified type.

Note that the instances are returned on the stack.

Parameters

self :

stingray.SceneGraphComponent

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

entity :

stingray.Entity

The entity.

Returns

integer*

All entity instance IDs.

The * notation indicates that there may be zero or more instances of the specified type.

Note that the IDs are returned on the stack.

Parameters

self :

stingray.SceneGraphComponent

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

entity :

stingray.Entity

The entity.

node :

integer

The index of the node.

Returns

stingray.Matrix4x4

The local pose of the node.

Parameters

self :

stingray.SceneGraphComponent

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

entity :

stingray.Entity

The entity.

node :

integer

The index of the node.

Returns

stingray.Vector3

The local position of the node.

Parameters

self :

stingray.SceneGraphComponent

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

entity :

stingray.Entity

The entity.

node :

integer

The index of the node.

Returns

stingray.Quaternion

The local rotation of the node.

Parameters

self :

stingray.SceneGraphComponent

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

entity :

stingray.Entity

The entity.

node :

integer

The index of the node.

Returns

stingray.Vector3

The local scale of the node.

Parameters

self :

stingray.SceneGraphComponent

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

entity :

stingray.Entity

The entity.

id :

integer

The component instance id.

Returns

integer

The component instance.

Parameters

self :

stingray.SceneGraphComponent

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

entity :

stingray.Entity

The entity.

name :

string

The name of the node.

Returns

integer

The index of the node with the specified name in the scene graph.

If no such node exists, an error is raised.

Parameters

self :

stingray.SceneGraphComponent

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

entity :

stingray.Entity

The entity.

Returns

integer

The number of nodes in the entity's scene graph component.

Parameters

self :

stingray.SceneGraphComponent

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

entity :

stingray.Entity

The entity.

node :

integer

The index of the node.

Returns

integer?

The index of the parent node of the node, or nil if the node doesn't have a parent.

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

self :

stingray.SceneGraphComponent

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

entity :

stingray.Entity

The entity.

node :

integer

The index of the node.

pose :

stingray.Matrix4x4

The new local pose of the node.

Returns
This function does not return any values.

Changing the local pose will immediately change the world pose of the node and all its children to reflect the new pose.

Parameters

self :

stingray.SceneGraphComponent

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

entity :

stingray.Entity

The entity.

node :

integer

The index of the node.

position :

stingray.Vector3

The new local position of the node.

Returns
This function does not return any values.

Changing the local position will immediately change the world position of the node and all its children to reflect the new local position.

Parameters

self :

stingray.SceneGraphComponent

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

entity :

stingray.Entity

The entity.

node :

integer

The index of the node.

rotation :

stingray.Quaternion

The new local rotation of the node.

Returns
This function does not return any values.

Changing the local rotation will immediately change the world rotation of the node and all its children to reflect the new local rotation.

Parameters

self :

stingray.SceneGraphComponent

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

entity :

stingray.Entity

The entity.

node :

integer

The index of the node.

scale :

stingray.Vector3

The new local scale of the node.

Returns
This function does not return any values.

Changing the local scale will immediately change the world scale of the node and all its children to reflect the new local scale.

Parameters

self :

stingray.SceneGraphComponent

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

entities :

table

A list of entities to set parent/child relationships for.

parent_indices :

table

A list of the same length as the entity list of parent indexes. Use false as an index for an entity that has no parent.

Returns
This function does not return any values.

This function should be called after adding and configuring all components, but before spawned.

Parameters

self :

stingray.SceneGraphComponent

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

instance :

integer

The component instance.

key :

any(string, string[])

The key for the property whose value you want to set.

The any(...) notation indicates that this item may be an instance of any of the types shown in the parentheses.

value :

any

The value to set for the key.

Returns
This function does not return any values.

The key can either be a dot separated string "fog.color.red" or an array of strings {"fog", "color", "red"}. Both methods can be used interchangeably.

The value can be any value supported by the property system: nil, boolean, number, string or an array of floats.

You can use a Vector3 or a Quaternion instead of passing an array of 3 or 4 floats.

Setting the value to nil can be used to erase the property.

Parameters

self :

stingray.SceneGraphComponent

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

entity :

stingray.Entity

The entity.

id :

integer

The component instance id.

key :

any(string, string[])

The key for the property whose value you want to set.

The any(...) notation indicates that this item may be an instance of any of the types shown in the parentheses.

value :

any

The value to set for the key.

Returns

integer

The component instance.

The key can either be a dot separated string "fog.color.red" or an array of strings {"fog", "color", "red"}. Both methods can be used interchangeably.

The value can be any value supported by the property system: nil, boolean, number, string or an array of floats.

You can use a Vector3 or a Quaternion instead of passing an array of 3 or 4 floats.

Setting the value to nil can be used to erase the property.

Calling this function will do an additional lookup from the specified component id to component instance. When setting multiple properties it is better to to first lookup the component instance with the component id and then call set_property.

Parameters

self :

stingray.SceneGraphComponent

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

entities :

table

A list of entities to call spawned for.

Returns
This function does not return any values.

This should be called after creating and configuring and entity and its components, to finalize its introduction to the world.

Parameters

self :

stingray.SceneGraphComponent

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

entity :

stingray.Entity

The entity.

node :

integer

The index of the node.

Returns

stingray.Matrix4x4

The world pose of the node.

Parameters

self :

stingray.SceneGraphComponent

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

entity :

stingray.Entity

The entity.

node :

integer

The index of the node.

Returns

stingray.Vector3

The world position of the node.

Parameters

self :

stingray.SceneGraphComponent

Specifies the object instance that this function will act on.

You may use the colon : calling syntax to call this function on an instance of this object. If you do so, you must omit this parameter. For more information, see this Stingray help topic, or this page in the Lua documentation.

entity :

stingray.Entity

The entity.

node :

integer

The index of the node.

Returns

stingray.Quaternion

The world rotation of the node.