Is it possible to feed some data instead of time to an animation clip?

Hi,

Is it possible to feed some data instead of time to an animation clip? for example attach positionX of one object as an input for an animation clip. like drivenKey in Maya.

Thanks in advance.

You can change AnimationState.time such as:

function Update()
{
    animation["someClip"].time = someTransform.position.x;
}

That way, moving someTransform to the right will advance the animation. Moving someTransform to the left will reverse the animation. Essentially, the x component control the animation step.