返回介绍

AnimationState.weight 权重

发布于 2019-12-18 15:37:13 字数 2376 浏览 1216 评论 0 收藏 0

JavaScript => public var weight: float;
C# => public float weight;

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%.

权重分发因此顶层可以获取所有。如果他不使用所有权重那么下一个层分发其余的权重等等。一旦所有的权重都用顶层,没有权重将供unity使用公平的权重,这意味着如果较低层想要 80%和 50%已经被使用了,图层不会用完所有的权重较低层。相反,它会占用 80%的 50%。

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

JavaScript:

weight  name   layer   lower   upper
	 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.大多数时间权重类似在曲线之间。

Javascript:

 

C#:

weight  name   layer   lower   upper
	 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.

C#:

using UnityEngine;
using System.Collections;
 
public class ExampleScript : MonoBehaviour
{
    public Animation anim;
 
    void Start()
    {
        // Set the blend weight of the walk animation to 0.5
        anim["Walk"].weight = 0.5f;
    }
}

animationstate

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文