[Unity3d]向量的過度方法以及拖尾效果


Vector3.RotateTowards()

  • 用法
public static function RotateTowards(current: Vector3, target: Vector3, maxRadiansDelta: float, maxMagnitudeDelta: float): Vector3;
  • 說明:限定了每個偏轉的閾值

Vector3.SmoothDamp() 彈性過渡

  • 用法
public static function SmoothDamp(current: Vector3, target: Vector3, ref currentVelocity: Vector3, smoothTime: float, maxSpeed: float = Mathf.Infinity, deltaTime: float = Time.deltaTime): Vector3;
public static function SmoothDamp(current: Vector3, target: Vector3, ref currentVelocity: Vector3, smoothTime: float, maxSpeed: float = Mathf.Infinity, deltaTime: float = Time.deltaTime): Vector3;
public static function SmoothDamp(current: Vector3, target: Vector3, ref currentVelocity: Vector3, smoothTime: float, maxSpeed: float = Mathf.Infinity, deltaTime: float = Time.deltaTime): Vector3;
  • 用法:也是從一個向量值轉向另一個向量值,不過可以傳入一個彈性值smoothTime。當2個向量相差大的時候,則過度的會快,反之則過度的慢,這也是推薦的方法

Vector3.Lerp

  • 用法
public static function Lerp(a: Vector3, b: Vector3, t: float): Vector3;
  • 說明:如果float的值是0,則返回的向量值是a;如果float的值是1,則返回的向量值是b, 0.5則是這2個向量的中間值

設置物體的拖尾效果

  • 創建一個空物體並且添加拖尾特性:
  • 運行效果:

制作子彈

  • 創建Quad對象並且在其父級的空對象中添加Halo效果


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM