unity, Additive Animtion注意事项

本文详细介绍了Unity中Additive动画的工作原理及注意事项。包括:Additive动画如何通过差值叠加效果;为避免非预期行为,每个Transform需同时播放Base动画;Additive动画层需设置得比Base动画层高。

以下摘自官方文档:(http://docs.unity3d.com/Manual/AnimationScripting.html)

Additive animations allow you to overlay the effects of one animation on top of any others that may be playing. When generating additive animations, Unity will calculate the difference between the first frame in the animation clip and the current frame. Then it will apply this difference on top of all other playing animations.

Tip: When using Additive animations, it is critical that you also play some other non-additive animation on every transform that is also used in the additive animation, otherwise the animations will add on top of the last frame’s result. This is most certainly not what you want.

其中包含三个要点:

1,Additive动画第一帧是参考帧,其余帧与之求差值。也就是说对于Additive动画而言,各帧是什么样并无卵用,有用的是各帧与第一帧的差值。

2,对于一个Transform,只对其播放Additive动画,可能产生非预期行为。正确的做法是在对一个Transform的某个属性P播放Additive动画的时候至少保证此Transform的属性P同时也在播放着某个非Additive动画,即Additive动画需要一个Base动画作为基础。

3,Additive动画的animationLayer值要比相应的Base动画的animationLayer值大。(参考:http://answers.unity3d.com/questions/218370/basic-question-about-additive-animation.html)

补充:

经过试验,如果一个Transform的某属性P没有相应的Base动画,那么在此Additive动画开始播放时用代码强制设置此Transform的属性P第一帧的值也可以避免additive动画出现非预期行为。

参考:

http://forum.unity3d.com/threads/weird-additive-animation-behavior.40250/

http://answers.unity3d.com/questions/218370/basic-question-about-additive-animation.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值