AnimationState.weight 权重

var weight : float

Description描述

The weight of animation

动画权重

This calculates the blend weights for one curve.

它计算动画曲线的混合权重

Weights are distributed so that the top layer gets everything. If it doesn't use the full weight then the next layer gets to distribute the remaining weights and so on. Once all weights are used by the top layers, no weights will be available for lower layers anymore Unity uses fair weighting, which means if a lower layer wants 80% and 50% have already been used up, the layer will NOT use up all weights. instead it will take up 80% of the 50%.

权重分配从最高层获取.如果最高层没有获取全部权重,其下一层将获取其余的权重并以此类推.一旦顶层使用了全部权重,较低层将没有权重可用.这意味着在上层已经占用50%的情况下低层想占用80%时,此层占用的将不是全部权重的80%,而是50%中的80%.

Example: a upper body which is affected by wave, walk and idle a lower body which is affected by only walk and idle weight name layer lower upper

20%     wave      2        0%         20%

50%     walk       1      50%         40%

100%    idle       0      50%         40%

例如: 上体受wave,walk和idle影响,下体受walk和idle影响.

20%     wave      2        0%         20%

50%     walk       1      50%         40%

100%    idle       0      50%         40%

Blend weights can change per animated value because of mixing. Even without mixing, sometimes a curve is just not defined. Still you want the blend weights to add up to 1. Most of the time weights are similar between curves.

混合权重靠混合来改变动画.甚至没有混合,有时连动画曲线都没有定义,你仍可以将混合权重加到1.多处情况下曲线中的权重是一致的.

using UnityEngine;

using System.Collections;



public class example : MonoBehaviour {

	public void Awake() {

		animation["Walk"].enabled = true;

		animation["Walk"].weight = 1.0F;

	}

}

// Enable the walk cycle

// 启用行走动作循环

animation["Walk"].enabled = true;

animation["Walk"].weight = 1.0;
Page last updated: 2011-1-6