Animator
Animator API allows changing the animator component of an entity.
Properties
normalizedTime: number
(readonly)
Current normalized animation time in animator. The normalized value is between [0.0, 1.0]
. If animator component does not exist, this property returns nil
.
local normalizedTime = entity.animator.normalizedTime
currentState: AnimationState
(readonly)
Current animation state in animator. This value is represented by a table that has the following properties:
name
: Animation state name. The name is derived from the names of animation states stored in animator asset.
If animator component does not exist, this property returns nil
.
local state = entity.animator.currentState
local name = state.name
Methods
trigger(event: string): void
Transition to new animation state based on event define in animator asset.
If it is not possible to transition to the state with the given event, the function does nothing.
entity.animator:trigger("Move")
Parameters:
event
: Event name defined in animator asset represented as string.
delete(): void
Delete animator component.
entity.animator:delete()