插件(一)武器拖尾效果

刚好有空,就有兴趣看了看U3D的武器拖尾功能,没想到有插件。下载地址:

Pocket+RPG+Weapon+Trails.unitypackage

http://download.csdn.net/detail/l364244206/5085651

 

PocketRPG Trails的例子演示效果

左刀挥动


双刀效果

 

PocketRPG的例子中已经有实现拖尾效果的脚本及说明文档,我只是将自己实际使用时遇到的问题与使用步骤更详细的写下来。

 

WeaponTrail


实现拖尾效果的脚本。

参数:

Height:拖尾效果的高度,对应武器的长度

Time:拖尾效果残留事件

Always Up:

Min Distance:

Time Transition Speed:

Desired Time:

Start Color:开始颜色

End Color:结束时颜色


使用(PocketRPG文档的ReadMe中有提及)

1.Calling StartTrail(float timeToTweenTo,floatfadeInTime) andFadeOut(float fadeTime)will fade in andfade out the trail respectively.

调用StartTrail和FadeOut函数去实现渐显示和渐消失的效果。时间参数以1秒为一个单位。

2.Calling SetTime(float trailTime, floattimeToTweenTo,float tweenSpeed)can change the length of thetrailinstantly, giving you a little more control.

调用SetTime函数去改变拖尾长度

3.The WeaponTrail can be built bycallingItterate(floatitterateTime) andUpdateTrail(floatcurrentTime, floatdeltaTime). These functions are calledbyAnimationController, however if you don't want to useAnimationController youcan call these yourself.

调用Itterate和Update函数去更新拖尾效果,目前还不明白这两个函数的参数怎样添好,幸运的是,PocketRpg的开发者做了AnimationController脚本去代替我们调用这两个函数使拖尾效果更好。



AnimationController

控制动作,使拖尾效果更好

参数:

Gather Delta Time Automatic:


使用

1.调用AddTrail函数去添加受影响的WeapontTrail对象。

2.调用PlayAnimation函数去切换动作。

-----------------------------------------------------------------------------------------

应用:

为了有一个不错的效果,还是用到源码包中的拖尾材质

 
并把这两个主要脚本引用到自己的项目中:
插件(一)武器拖尾效果
 
WeaponTrail添加到武器的对象上。并添加如下组件。如图:

 插件(一)武器拖尾效果



然后将AnimationController组件添加到人物的对象上:

  插件(一)武器拖尾效果

下面就可以写代码测试下啦:
插件(一)武器拖尾效果
  运行看看:
插件(一)武器拖尾效果  插件(一)武器拖尾效果
参考:http://blog.csdn.net/xv_ly15/article/details/8509781
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值