[英]Unity Mecanim - play animation in certain amount of time
編程 RPG 游戲,我想控制 animation 速度與其持續時間有關。
例如,角色必須在 X 秒內施法。 我想玩 animation state 這么快,所以 animation 正好在 X 秒內完成。
-X 在啟動 animation 之前確定。
-我有多個角色的多個動畫,所以我想通過手動計算和調整動畫師中的 animation 剪輯速度來避免這樣做
我該如何實現這種行為?
您可以更改動畫組件的速度。 問題是您應該在游戲循環的每次迭代(或每次 Y 次)上更新速度。
Animation 速度可能為 [0-1],其中 1 為默認值。 您需要獲取 animation 的長度,並根據您的 X 和 animation 進行一些計算。
類似於: float length = gameObject.animation.clip.length;
newSpeed =....
https://answers.unity.com/questions/902029/how-to-get-and-change-animation-speed-of-animator.html
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.