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