Mecanim OnAnimatorMove issue

I have a Mecanim generic animator, with a simple run animation, and “Apply Root Motion” works fine, the character moves in the world, but if i try “OnAnimatorMove” to handle the motion with hand.

	void OnAnimatorMove(){
		Vector3 delta = this.GetComponent<Animator>().deltaPosition;
		Debug.Log("delta : " + delta);
	}

The consle trace the delta is always “delta : (0.0, 0.0, 0.0)”, so if I apply the motion in OnAnimatorMove, it will NOTmove. Please help, i need this way, whatdo i miss? Or is this a bug?

Same thing, If i change the animator to Humanoid, the delta become with right value.
Only when i set it to Generic , the delta will be always zero.
(I have the “Root Node” set correctly)

look like there is an issue with deltaPosition and deltaRotation.
but you can use this workaround for now
void OnAnimatorMove(){

//Vector3 delta = this.GetComponent().deltaPosition;
//Debug.Log("delta : " + delta);
transform.position = anim.rootPosition;

}

1 Like

Thanks, rootPosition does works.

I am working win a non-biped character and for the first time, I can see it running using this method, but it moves only on on one axis – it moves only forward and backward.

I can see that the animations for left and right turns are OK, because the character tilts a little and turns the head a bit in the direction of the turn, but the motion continues forward…(The animations work correctly in Blend Tree Previews). Apply Root Motion section says it is Handled by Script and I don’t see any way to change this in the Animator Inspector (Am I missing something?)

Is there a way to add both x z axis to this “transform.position = anim.rootPosition” statement?

Never mind my question. I’ve noticed that the update 4.0.1 fixed this issue. I am downloading it now…