Drive animation trees and attributes on an entity.
26 natives. Read-only natives only look things up; the rest change something. Parameter types use the language's names (Types ).
$ animation . anim_tree (entity: Entity , tree: Reference , transitions: list , time: int )
Declare an immediate mode anim tree instance and update it. Only one instance of the same anim_tree asset can be declared per component.
Parameter Type Meaning entityEntityThe entity context. treeReferenceThe tree. transitionslistThe hash values of the transition names whose conditions are met. timeintThe time of the tree in milliseconds. Determines state machine times. See also animation.set_pos_time.
$ animation . attribute (entity: Entity , name_hash: int , value: var )
Declare a named animation attribute for the specified entity.
Parameter Type Meaning entityEntityThe entity context. name_hashintThe hash value of the attribute name. valuevarThe attribute value.
$ animation . blend_list_of_poses_linear (poses: list , weights: list ) -> int
Linearly blend multiple poses into a new pose.
Parameter Type Meaning poseslistA list of pose handles. weightslistA list of weights for poses. Don't specify to blend each pose equally.
Returns int: A handle to the pose that will remain valid for this frame only.
$ animation . blend_poses_additive (pose: int , additive_pose: int , additive_base_pose: int , blend_weight: float ) -> int
Blend two poses into a new pose using an additive blend.
Parameter Type Meaning poseintA pose handle. additive_poseintThe additive pose handle. additive_base_poseintThe handle of the pose additive_pose is sampled relative to, or k_vanim_null_pose_handle to sample additive_pose relative to its default additive base animation (specified on a .animation asset). blend_weightfloatThe additive blend weight.
Returns int: A handle to the pose that will remain valid for this frame only.
$ animation . blend_poses_layer (pose1: int , pose2: int ) -> int
Blend two poses into a new pose using a layer blend. Pose 2 shows through at the bones not fully contributed to by pose 1.
Parameter Type Meaning pose1intA pose handle. pose2intAnother pose handle.
Returns int: A handle to the pose that will remain valid for this frame only.
$ animation . blend_poses_linear (pose1: int , pose2: int , blend_weight: float ) -> int
Blend two poses into a new pose using a linear blend.
Parameter Type Meaning pose1intA pose handle. pose2intAnother pose handle. blend_weightfloatWeight of pose2, 1 - weight of pose1.
Returns int: A handle to the pose that will remain valid for this frame only.
$ animation . fire_triggers (entity: Entity , recipients_root_entity: Entity )
Fire animation triggers of animations playing on the specified entity.
Parameter Type Meaning entityEntityThe animated entity. Must be the same entity as input from animation.set_model_pose recipients_root_entityEntityScript events can be received on components of this entity and its children.
$ animation . get_bone_position (bone_name: string , entity: Entity , ragdoll: Reference , ignore_warning: bool , allowed_error: float , empty_list_if_not_found: bool ) -> list
Get the model-space position of a bone in the specified animation. Samples the animation if not already sampled this frame.
Parameter Type Meaning bone_namestringName of the bone to sample. entityEntityThe entity to retrieve pose from, also used for combining skeletons for animation. Must be the same entity as input from animation.set_model_pose ragdollReferenceAn optional ragdoll ignore_warningboolWhether to ignore warning if bone doesn't exist allowed_errorfloatAllowed world unit error when posing skeleton. Higher values allow faster processing empty_list_if_not_foundboolWhether to return an empty list (zero elements) or a zero vector (three elements) when a bone doesn't exist, useful when code needs to detect when a bone isn't found
Returns list: List containing the bone position and rotation in model space.
$ animation . get_duration (animation: Reference ) -> float
Get the duration of the specified animation in seconds.
Parameter Type Meaning animationReferenceThe animation.
Returns float: The animation duration in seconds.
$ animation . get_last_sync_tree_time (tree: Reference , state_machine_name: string ) -> int
Get the last sync transition time
Parameter Type Meaning treeReferenceThe tree. state_machine_namestringThe fullname of a tree node of type state machine.
Returns int: Last synced transition time in milliseconds.
$ animation . get_name (animation: Reference ) -> string
Get the name of the specified animation or blendspace.
Parameter Type Meaning animationReferenceThe animation.
Returns string: The animation name.
$ animation . get_spreadsheet_column_length (spreadsheet: Reference , column: int ) -> int
Get the length of a spreadsheet column.
Parameter Type Meaning spreadsheetReferenceThe spreadsheet. columnintThe column. Zero indexed.
Returns int: The column length.
$ animation . get_spreadsheet_row_length (spreadsheet: Reference , row: int ) -> int
Get the length of a spreadsheet row.
Parameter Type Meaning spreadsheetReferenceThe spreadsheet. rowintThe row. Zero indexed.
Returns int: The row length.
$ animation . get_spreadsheet_value (spreadsheet: Reference , row: int , column: int ) -> Reference
Get an animation from a spreadsheet by row and column.
Parameter Type Meaning spreadsheetReferenceThe spreadsheet. rowintThe row. Zero indexed. columnintThe column. Zero indexed.
Returns Reference: The animation.
$ animation . get_time_step (animation: Reference ) -> float
Get the time step of the specified animation in seconds.
Parameter Type Meaning animationReferenceThe animation.
Returns float: The animation time step in seconds.
$ animation . get_tree_state (tree: Reference , state_machine_name: string ) -> list
Get the names of the current state of an anim tree state machine (Example: if transitioning to the node root.hit.start, [hit, start] is returned.)
Parameter Type Meaning treeReferenceThe tree. state_machine_namestringThe fullname of a tree node of type state machine.
Returns list: The fullname of the current state in list format.
$ animation . get_tree_transition_state (tree: Reference , state_machine_name: string ) -> list
Get the id and start time of an anim tree state machine's transition. The transition id will be the same in all game instances.
Parameter Type Meaning treeReferenceThe tree. state_machine_namestringThe fullname of a tree node of type state machine.
Returns list: The list [transition id, transition start time].
$ animation . is_rollback_enabled () -> bool
Query if animation rollback is enabled.
Returns bool: True if animation rollback is enabled, false otherwise.
$ animation . override_list_attribute (entity: Entity , spreadsheet: Reference , original_col: int , override_col: int , allow_null_override: bool )
Declare a spreadsheet of animation overrides for the specified entity. Overridden animations can be overridden if this function is called again.
Parameter Type Meaning entityEntityThe entity context. spreadsheetReferenceThe spreadsheet of animation overrides. original_colintThe spreadsheet column containing animations to be replaced. Zero indexed. override_colintThe spreadsheet column containing replacement animations. Zero indexed. allow_null_overrideboolWhether animations may be replaced by null.
$ animation . pose (ref: Reference , entity: Entity ) -> int
Make a pose from either an animation or a blendspace or an anim tree. The returned pose handle is only valid for this frame and on this component.
Parameter Type Meaning refReferenceThe animation or blendspace or anim tree. entityEntityThe entity context.
Returns int: A handle to the pose that will remain valid for this frame only.
$ animation . set_model_pose (entity: Entity , pose: int )
Set the pose that will be used for animation sampling of a model. Neither this pose nor its children may be modified after this call.
Parameter Type Meaning entityEntityThe entity to use as pose context poseintA pose handle.
$ animation . set_pose_blendspace_inputs (pose: int , inputs: list )
Apply blendspace inputs to a pose.
Parameter Type Meaning poseintA pose handle. inputslistHashed names and values of blendspace inputs. Anim tree blend inputs must be in range [0, 1].
$ animation . set_pose_time (pose: int , time: int , elapsed_time: int )
Set the animation time of a pose.
Parameter Type Meaning poseintA pose handle. timeintThe time in milliseconds. Child poses inherit this time if they have no other source of time, such as the time of an anim tree state machine transition, or time specified by another call to set_pose_time. elapsed_timeintThe difference between time_ms this frame and last frame in milliseconds. This is used to evaluate animation triggers.
$ animation . sync_tree (tree: Reference , state_machine_name: string , target_transition_id: int , target_transition_time: int ) -> bool
Synchronize an anim tree state machine with a target transition.
Parameter Type Meaning treeReferenceThe tree. state_machine_namestringThe fullname of a tree node of type state machine. target_transition_idintThe id of the desired transition. target_transition_timeintThe start time of the desired transition in milliseconds.
Returns bool: True if the anim tree changed during the sync, False otherwise.
$ animation . unpack_blendspace (blendspace: Reference , input_name: string , input_value: vec3 ) -> list
Unpack an animation blendpsace given an input value.
Parameter Type Meaning blendspaceReferenceThe animation blendspace to unpack input_namestringThe blendspace input name input_valuevec3The blendspace input value
Returns list: List of pairs containing an animation instance index and a corresponding weight.
$ animation . wait (component: Component )
Wait for a component which is expected to call set_model_pose.
Parameter Type Meaning componentComponentThe component to wait for.