A component that handles animation blending for an entity.
Constructors and accessors
Other related reference items
Related help topics
bone_mode ( self, entity ) : stingray.AnimationBlenderBoneModeReturns the bone mode of the animation blender.
|
self : | 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 : | The entity. |
The bone mode of the animation blender. |
create ( self, entity, id ) : integerCreates a component instance for the entity with the specified component id.
|
self : | 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 : | 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. |
integer |
The component instance. |
crossfade ( self, entity, animation, layer, blend_time, loop ) : integerPlays an animation directly on the entity without using an animation state machine.
|
self : | 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 : | The entity. | |
animation : | string | The name of the .animation resource that should be played. |
layer : | integer? | The layer the animation should be played in (defaults to 0). The ? notation indicates that this type is optional: there may be zero or one instances of it. |
blend_time : | number? | The time to blend in the animation in the specified layer (defaults to 0). The ? notation indicates that this type is optional: there may be zero or one instances of it. |
loop : | boolean? | Specifies whether the animation should loop or not (defaults to true). The ? notation indicates that this type is optional: there may be zero or one instances of it. |
integer |
The ID of the playing animation. |
The animation is blended in the specified layer over the specified blend_time. If the animation is not specified to loop it will freeze in the end pose (unless you blend in another animation).
Note that if you are using an animation state machine, it will interfere with animations played directly on the animation blender.
Returns an id that can be used to control the animation.
Other related reference items
delta_transform ( self, entity ) : stingray.Matrix4x4Returns delta transform from the animation to be applied to the entity.
|
self : | 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 : | The entity. |
Transform delta for the entity from the animation. |
When running in AnimationBlenderRootMode.IGNORE mode, this function returns the delta transform that the animation blender would want to apply to the entity. You could use this to apply the animation movement manually from the script or pass it through other systems (such as the mover, etc).
destroy ( self, instance )Destroys a particular component instance for an entity.
|
self : | 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. |
This function does not return any values. |
destroy_all ( self, entity )Destroys all component instance(s) for an entity.
|
self : | 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 : | The entity to destroy all component instances for. |
This function does not return any values. |
get_property ( self, instance, key ) : any*Gets the value of a property key.
|
self : | 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. |
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.
get_property_by_id ( self, entity, id, key ) : any*Gets the property value for the component instance matching the specified id.
|
self : | 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 : | 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. |
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.
instances ( self, entity ) : integer*Returns all component instances for the specified entity.
|
self : | 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 : | The entity. |
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.
instance_ids ( self, entity ) : integer*Returns the IDs for all the entity's components.
|
self : | 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 : | The entity. |
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.
is_crossfading ( self, entity ) : booleanReturns true if any animation is currently crossfading.
|
self : | 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 : | The entity. |
boolean |
True if any animation is currently being crossfaded. |
You can use this to avoid overlaying too many crossfading animations on top of each other.
lookup ( self, entity, id ) : integerReturns the component instance for the specified id.
|
self : | 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 : | The entity. | |
id : | integer | The component instance id. |
integer |
The component instance. |
root_mode ( self, entity ) : stingray.AnimationBlenderRootModeReturns the root mode of the animation blender.
|
self : | 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 : | The entity. |
The root mode of the animation blender. |
set_bones_lod ( self, entity, lod )Returns the desired new entity transform.
|
self : | 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 : | The entity. | |
lod : | integer | The new bones lod level for the animation. |
This function does not return any values. |
When running in AnimationBlenderRootMode.IGNORE mode, this function returns the pose that the animation blender would want to move the entity to. You could use this to apply the animation movement manually from the script or pass it through other systems (such as the mover, etc).
set_bone_mode ( self, entity, bone_mode )Sets the bone mode of the animation blender.
|
self : | 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 : | The entity. | |
bone_mode : | The new bone mode of the animation blender. |
This function does not return any values. |
set_parent ( self, entities, parent_indices )For each entity, looks in the parent_indices and sets the parent to the given parent index.
|
self : | 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. |
This function does not return any values. |
This function should be called after adding and configuring all components, but before spawned.
set_property ( self, instance, key, value )Sets the value for a property key.
|
self : | 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. |
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.
set_property_by_id ( self, entity, id, key, value ) : integerSets the property value and returns the component instance matching the specified id.
|
self : | 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 : | 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. |
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.
set_root_mode ( self, entity, root_mode )Sets the root mode of the animation blender.
|
self : | 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 : | The entity. | |
root_mode : | The new root mode of the animation blender. |
This function does not return any values. |
set_speed ( self, entity, id, speed )Sets the playback speed of an animation played with crossfade.
|
self : | 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 : | The entity. | |
id : | integer | Id of the crossfade animation. |
speed : | number | The new speed of the animation playback. |
This function does not return any values. |
The seed is set with respect to the speed of the blender. A value of 1 means it uses the same time step as the blender. A value of 0 means it is frozen. You cannot use negative values for the speed.
self : | 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 : | The entity. | |
id : | integer | Id of the crossfade animation. |
time : | number | The time in the animation to set. |
This function does not return any values. |
spawned ( self, entities )For each entity, calls spawned for this component type.
|
self : | 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. |
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.