简体   繁体   中英

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 .

 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

You can find more informations under the following link from Unity https://docs.unity3d.com/Manual/AnimationLayers.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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