Prevent Axis movement when sampling animation

Hello,

I have an animation applied to an Animator component applied to a Humanoid Game Object.

I’m using a timeline to jump to any frame of the sampled animation at any time in a custom editor. animationClip.SampleAnimation(character, animationTime);

However, when sampling through the animation, the animation has the character move along the x-axis while the “position” of the character gameobject remains at initial position.

Is there a way I can code it so that the new position it’s animating/moving the character to is ignored?

Thanks

If the Object have a RigidBody, you can “freeze” one axis position or rotation in the Rigidbody component ;D