Animation / Position update not simultaneous...

Hi!

I’m playing an animation for a guy climbing a ladder. The way we’ve done it, the animator animates the guy from a Start pos to and End pos. When the anim is done, I change the animation to the idle anim, and move the object’s position to the End pos.

It works, except the new animation and new position don’t happen in the same frame. So he appears back at the bottom of the ladder since the animation updates first, then he reappears back at the top when the position updates. I tried adding a one-frame delay between the position and animation update, but that didn’t seem to work.

if(_animation[ladderUpAnimation.name].normalizedTime >= 1.0)
{
	_animation.Play(idleAnimation.name);
	temppos = offMeshLinkEndPos;
	temppos.y = transform.position.y + offMeshLinkEndPos.y - offMeshLinkStartPos.y;
	transform.position = temppos;
}

This is probably because your if statement will catch when your animation has stopped the frame after it has stopped. I suggest setting your ladderUpAnimation to ClampForever loop mode. As a result the IsPlaying test may not work so you might have to check if normalizedTime >= 1 instead.

Good luck.