Skip to content

tes3animationData⚓︎

A game object which contains information on actor's animations.

Animations are divided into three layers. The layer 0 is the base layer containing all the base animations for every humanoid in the game, including the player (when in third person). These animations come from base_anim.nif. Layer 1 is for female animations. Any animations present in base_anim_female.nif override their male counterparts for humanoid races. For beast races, layer 1 animations come from base_anim_kna.nif. Layer 2 are the custom animations assigned to the actor.

Properties⚓︎

actorNode⚓︎

Easy access to the actor's scene node.

Returns:


animationGroups⚓︎

Read-only. An array of animation group objects applying to this actor, indexed by the tes3.animationGroup namespace. As this is a Lua array access, you will need to add one to the enum index.

Returns:


animGroupLayerIndices⚓︎

Read-only. The layer from which each of the actor's animation groups come. Indexed by the tes3.animationGroup namespace. As this is a Lua array access, you will need to add one to the enum index.

Returns:

  • result (number[])

animGroupSoundGenCounts⚓︎

Read-only. The number of sound generators for each of the animation groups, indexed by the tes3.animationGroup namespace. As this is a Lua array access, you will need to add one to the enum index.

Returns:

  • result (number[])

approxRootTravelDistances⚓︎

Read-only. The approximate root node travel distance over a cycle for each of the animation groups, indexed by the tes3.animationGroup namespace. As this is a Lua array access, you will need to add one to the enum index.

Returns:

  • result (number[])

blinkMorphEndTime⚓︎

Blink animation end time for headMorphTiming. Timing is specific to the current head model.

Returns:

  • result (number)

blinkMorphStartTime⚓︎

Blink animation start time for headMorphTiming. Timing is specific to the current head model.

Returns:

  • result (number)

castSpeed⚓︎

The animation speed multiplier for the spell casting animation. This is a feature added by MWSE.

It functions slightly differently to the other animation speed multipliers. It is not reset by the AI like the movement and weapon speeds. Therefore, it can be set before a spell is cast, as well as during casting. The speed will affect all further casting by the actor.

Returns:

  • result (number)

currentActionIndices⚓︎

Read-only. The action index of the currently playing animation on each of the body sections. As this is a Lua array access, you will need to add one to the enum index. The meaning of an action index depends on the specific animation group.

Returns:

  • result (number[])

currentAnimGroupLayers⚓︎

Read-only. The layer index of the currently playing animation on each of the body sections. As this is a Lua array access, you will need to add one to the enum index.

Returns:

  • result (number[])

currentAnimGroups⚓︎

Read-only. The currently playing animation group, on each of the body sections. As this is a Lua array access, you will need to add one to the enum index.

Returns:

  • result (number[])

currentSoundGenIndices⚓︎

Read-only. The index of the currently used sound generator for each of the body sections. As this is a Lua array access, you will need to add one to the enum index.

Returns:

  • result (number[])

deltaTime⚓︎

The time in seconds since the last update.

Returns:

  • result (number)

flags⚓︎

Returns:

  • result (number)

hasOverrideAnimations⚓︎

Read-only. True if the actor has some custom animations in the override layer. For example, drumming or sitting. These are assigned in the Construction Set or using tes3.loadAnimation.

Returns:

  • result (boolean)

headGeometry⚓︎

Returns:


headMorphTiming⚓︎

The timing offset of the head morph controller. Used to select either blinking or lipsync animations. Actively updated by the animation system during blinking or voiceovers. Timing is specific to the current head model.

Returns:

  • result (number)

headNode⚓︎

Returns:


keyframeLayers⚓︎

Read-only.

Returns:


lipsyncLevel⚓︎

This value indicates whether the NPC is speaking or not. The table below describes the relationship.

Value Behavior
-1.0 The NPC isn't speaking.
0.0 - 1.0 The NPC is speaking. The value roughly corresponds to the current loudness of the voiceover line. The lipsyncLevel is 0.0 when there is a silent part in the sound file the NPC is currently speaking. Also, the speaking actor's mouth is opened more when the value is higher.

Returns:

  • result (number)
Example: isSpeaking

Check if the NPC is speaking

--- Returns true if the actor is currently speaking a voiceover line.
---@param mobile tes3mobileActor
---@return boolean isSpeaking
local function isSpeaking(mobile)
    local ad = mobile.animationController.animationData
    return (ad.lipsyncLevel ~= -1)
end

loopCounts⚓︎

Read-only.

Returns:

  • result (number[])

manager⚓︎

Returns:


movementRootNode⚓︎

Easy access to the actor's "MRT" movement root node.

Returns:


movementSpeed⚓︎

Read-only. The animation speed multiplier of movement animations. This includes walking, running, crouching, swimming, turning, jumping and other movement related animations.

Returns:

  • result (number)

nextLoopCounts⚓︎

Returns:

  • result (number)

positionDeltaMovementRoot⚓︎

Tracks the change from the last frame of the "MRT" child node that controls animation driven movement.

Returns:


spine1Node⚓︎

Returns:


spine2Node⚓︎

Returns:


spineAngle⚓︎

Returns:

  • result (number)

talkMorphEndTime⚓︎

Lipsync animation end time for headMorphTiming. Timing is specific to the current head model.

Returns:

  • result (number)

talkMorphStartTime⚓︎

Lipsync animation start time for headMorphTiming. Timing is specific to the current head model.

Returns:

  • result (number)

The time in seconds until the next blink. It is fixed at 0 while the blink animation plays.

Returns:

  • result (number)

timings⚓︎

The time in seconds indicating the current position within the animation for each individual body section, indexed by values in the tes3.animationBodySection table.

Returns:


weaponSpeed⚓︎

The animation speed multiplier of weapon animations. This includes all weapon related idle, attack, and ready/unready animations.

Returns:

  • result (number)

Methods⚓︎

getReference⚓︎

This method fetches the reference of the actor to whom this animation data belongs.

local result = myObject:getReference()

Returns:


playAnimationGroup⚓︎

This method plays an animation group on the related actor, invoking playGroup event.

myObject:playAnimationGroup(animationGroup, startFlag, loopCount)

Parameters:

  • animationGroup (tes3.animationGroup): The animation group to play. A value from tes3.animationGroup namespace.
  • startFlag (tes3.animationStartFlag): A flag for starting the group with, using tes3.animationStartFlag constants.
  • loopCount (number): If provided, the animation will repeat its loop section a given number of times. To make an animation play through once, set loopCount = 0, while -1 is used for infinite looping.

playAnimationGroupForIndex⚓︎

This method plays an animation group on the provided body section of related actor, invoking playGroup event.

myObject:playAnimationGroupForIndex(animationGroup, triIndex, startFlag, loopCount)

Parameters:


setHeadNode⚓︎

myObject:setHeadNode(head)

Parameters:


setOverrideLayerKeyframes⚓︎

local success = myObject:setOverrideLayerKeyframes(kfData)

Parameters:

  • kfData (tes3keyframeDefinition):

Returns:

  • success (boolean)

swapAnimationGroups⚓︎

Swaps the animations and related animation driven data for the two animation groups given. Groups are indexed by tes3.animationGroup. It can be used on animation groups of the same class with matching actions, e.g. runForward1h and runForward2c. It will also work on animations that are currently playing, except attack animations. Changing an attack animation during an attack will permanently break the character controller until you change it back. Currently playing movement animations may be reset slightly to resynchronize the movement cycle.

myObject:swapAnimationGroups(group1, group2)

Parameters: