PcoWSkbVqDnWTu_dm2ix
Collapse Sidebar

WeightCurrent

AnimationTrack

float

When weight is set in an AnimationTrack it does not change instantaneously but moves from WeightCurrent to AnimationTrack/WeightTarget. The time it takes to do this is determined by the fadeTime parameter given when the animation is played, or the weight is adjusted.

WeightCurrent can be checked against AnimationTrack/WeightTarget to see if the desired weight has been reached. Note that these values should not be checked for equality with the == operator, as both of these values are floats. To see if WeightCurrent has reached the target weight, it is recommended to see if the distance between those values is sufficiently small (see code sample below).

The animation weighting system is used to determine how AnimationTracks playing at the same priority are blended together. The default weight is one, and no movement will be visible on an AnimationTrack with a weight of zero. The pose that is shown at any point in time is determined by the weighted average of all the Poses and the WeightCurrent of each AnimationTrack. See below for an example of animation blending in practice.

Animation Weight Blending

In most cases blending animations is not required and using AnimationTrack/Priority is more suitable.


Code Samples


WeightCurrent and WeightTarget

This code sample loads two animations onto the local player’s Humanoid and demonstrates how the fadeTime paramater in AnimationTrack.Play determines how long it takes for an AnimationTrack’s WeightCurrent to reach it’s WeightTarget.

As WeightCurrent and WeightTarget are floats the == operator cannot be used to compare, instead it is more appropriate to check that the difference between them is sufficiently small to assume the weight fade has completed.