简体   繁体   English

如何暂时禁用 animation 以便统一更改角色身体的各个部分?

[英]How can I temporarily disable animation so that I can change parts of a character's body in unity?

Good afternoon.I have two layers in the animator for the upper body and for the lower, at one point I need to disable the layer for the upper body (for aiming the gun), so that I can adjust the current frame.How can I do this?下午好。我在动画器中有上半身和下半身的两层,有一次我需要禁用上半身的层(用于瞄准枪),这样我就可以调整当前帧。如何我这样做?

you can disable a layer by setting the LayerWeight .您可以通过设置LayerWeight来禁用图层。

 public float animWeight = 0.5f;
 public Animator anim;

 void Start () {
         anim.SetLayerWeight (2, animWeight);
 }

You should also be able to do this in the Inspector example您还应该能够在 Inspector示例中执行此操作

You can find more informations under the following link from Unity https://docs.unity3d.com/Manual/AnimationLayers.html您可以在 Unity https://docs.unity3d.com/Manual/AnimationLayers.html的以下链接下找到更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM