Skip to content

AnimatorControllerEntity

This AnimatorControllerEntity struct contains a set of functions for playing animation playables on the animator controller.

Functions

YaAnimationHandle Play(string playableName)

SERVER ONLY 
ReturnsYaAnimationHandle
Plays an animation playable on this AnimatorControllerEntity when the animation playable is on this entity. Returns a YaAnimationHandle which can get information or control this animation playable.
  • playableName the name of the animation playable

YaAnimationHandle Play(string playableName, number playbackRate)

SERVER ONLY 
ReturnsYaAnimationHandle
Plays an animation playable on this AnimatorControllerEntity when the animation playable is on this entity with a specified playback rate. Returns a YaAnimationHandle which can get information or control this animation playable.
  • playableName the name of the animation playable
  • playbackRate determines how fast the animation playable is played

YaAnimationHandle Play(string playableName, YaEntity playableContainerEntity)

SERVER ONLY 
ReturnsYaAnimationHandle
Plays an animation contained on AnimatorControllerEntity when the animation playable is on a specified entity. Returns a YaAnimationHandle which can get information or control this animation playable.
  • playableName the name of the animation playable
  • playableContainerEntity a container of targeted animation playable

In the following sample, when an entity activates an ability on a tool, play the animation named "SayHi".

1
2
3
4
5
local _selfEntity = script:SelfEntity()
local function OnAbilityActivate(ability)
    YaAnimatorAPI.Instance(ability.Owner):Play("SayHi",_selfEntity)
end
YaToolAPI.OnAbilityActivate(_selfEntity, OnAbilityActivate)