So I want to be able to know before playing an animation that applies rootmotion, where will my character be at the end of it?
EDIT:
Just seen I created this in the wrong forum. Could somebody move it to “Animation”?
So I want to be able to know before playing an animation that applies rootmotion, where will my character be at the end of it?
EDIT:
Just seen I created this in the wrong forum. Could somebody move it to “Animation”?
You could try something like this (untested)…
public Animator anim;
public Transform animRoot;
// [...]
anim.Play(clip, layer, 1); // set it to the end
Vector3 positionAtEnd = animRoot.position; // get the position
// todo: whatever you want, based on positionAtEnd
anim.Play(clip, layer, 0); // set it back to the beginning
// ..and if you don't want the animation to actually play right away, uncomment:
// anim.StopPlayback();
I already tried that with animancer(similar to animator but more flexible and with no animator graph)
but the animation transform position only seems to take effect on the next frame