[英]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.