Animationproblem with Lerp-Function

Hello there,

i am using the Smooth Moves Plugin for my 2D Animations and i got a little problem with the animations.

My BoneAnimation (it has got the SmoothMove Plugin Script, an Animation-Component and a Skinned Mesh Renderer-Component attached) doesn’t work quite accurat with my Lerp-Function:

(I work with C#!)

void Update () 
	
	{
		if(!moved)
		{
			StartCoroutine(MoveObject(start.position, destination.position, time));
		}
        }

IEnumerator MoveObject(Vector3 startPos, Vector3 endPos, float time)
	{
		
		float i = 0.0f;
		float rate = 1.0f/Vector3.Distance(startPos, endPos) * time;
		
		while(i < 1.0f)
		{
			i += Time.fixedDeltaTime * rate;
			
			moved = true;
		
			if(!BA_Wollkuh.IsPlaying("Sidewalk2"))
			{
				BA_Wollkuh.CrossFade("Sidewalk2");
			}
				BA_Wollkuh.mLocalTransform.position = Vector3.Lerp(startPos, endPos, Mathf.SmoothStep(0.0f,0.5f,i));
		
		
			moved = false;
			
			yield return null;
		}
	}

The problem is, that my animation is kind of a movement to the left and it has a “jittering”-Problem. The Bones of the animation move to the left, but the SkinnedMeshRenderer doesn’t follow the bones accurate. It waits till the animation is finished and THEN it follows.

Any suggestions, solutions?

I also solved this problem. I changed the Animation WrapMode to PingPong and used Translate instead of Lerp (also tried Lerp again, but didn’t give me the results i wanted)