0
我想知道Unity中动画结尾的根骨骼坐标。我尝试将带有Animator控制器程序的单元放到场景中,播放动画并执行Update()几次。但坐标与真实有些不同。 有没有方法在动画结束时知道精确的坐标?如何知道Unity中动画的结束坐标?
Upd。此代码应该工作,因为它应该,但它不准确的信息:
animator.transform.position = new Vector3(0, 0, 0);
animator.transform.rotation = Quaternion.Euler(0, 0, 0);
animator.Play(_hashName, 0, 0);
AnimatorStateInfo stateInfo = animator.GetCurrentAnimatorStateInfo(0);
duration = stateInfo.length;
float t = 0;
float delta = 0.01f;
while (t < duration)
{
animator.Update(delta);
t += delta;
}
Vector3 endCoords = animator.transform.position;
你可以添加一些代码吗? – Massimo
将我的代码添加到问题中 – Inflight