I have a NPC which has a strict match logic (bot player), and I am moving it on FixedUpdate()
,
However, on certain events in the game I am activating animations which are controlled by the Animator - animations that are not very feasible to script.
So, when I enable the Animator, the position of my character "jumps" to the animation frame position, which causes a very jittery/unsmooth behavior.
In order to move between the animations themselves, I use Animator.Crossfade
which works great, but does not work on the first animation I play when I enable the Animator.
I am trying to find a way to smooth the transition, e.g. using MoveTowards()
to the first frame position of the animation right before it starts playing, but I couldn't find any workaround that solves this case.
Here's an example of the character and the positions - the character has 3 Rigidbodies
that I am moving independently.
Origin position when moving with FixedUpdate()
(no Animator enabled):
P.S: Try setting the animation first frame to the (approximately) last FixedUpdate()
cycle is not really an option, since the position is subject to change, significantly.
Any ideas or ways of implementation would be highly appreciated.
normalisedEndTime
less than thenormalisedStartTime
or even zero, since all the internal math should be the same. \$\endgroup\$