U3D武器拖尾效果

来源:互联网 发布:知乎修改名字 编辑:程序博客网 时间:2024/04/27 16:03

最近项目需要,于是研究了下武器拖尾效果,无意间发现网上已经有插件可以很快实现效果,所以记录下来:

插件:

Pocket+RPG+Weapon+Trails.unitypackage

http://download.csdn.net/detail/yab1109/8336987

左刀挥动


双刀效果


实现拖尾效果的脚本:



参数:

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

Time:拖尾效果残留时间

Always Up:

Min Distance:

Time Transition Speed:

Desired Time:

Start Color:开始颜色

End Color:结束时颜色


使用:

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

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

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

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

3.The WeaponTrail can be built by callingItterate(float itterateTime)andUpdateTrail(floatcurrentTime, float deltaTime). These functions are called byAnimationController, however if you don't want to use AnimationController youcan call these yourself.

调用Itterate和Update函数去更新拖尾效果,


AnimationController脚本实现了对拖尾的效果设置和控制:

参数:

Gather Delta Time Automatic:

使用

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

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


实际应用:

这两个主要脚本引用到自己的项目中:
Unity3d <wbr>1.武器拖尾效果
 
WeaponTrail添加到武器的对象上。并添加如下组件

AnimationController组件添加到人物的对象上





0 0
原创粉丝点击