Animation keeps velocity, position and animation when re enabled,Animator keeps animation and velocity when re enabled

Hi guys, I have a script which toggles between animation and ragdoll.
I’m using animator.enabled to switch off the animation.
I’m controlling my character and let’s say that in mid-jump animation I toggle ragdoll mode. the character flops to the ground as expected, however as I re enabled the animator, it continues the jump animation from the same spot with the same velocity as before.

How can I avoid this so that I can re enable the animator without the previous state?

I should say that I’m using a blend tree for walking and running from the entry state, and from that I have a jump blend tree.


I think the solution is in “Parameters”, idk if you used, but when i made a character when he jumps and flops to the ground a gameobject (in the feets in player) and a parameter check if the player touch the ground. Parameters can manage animator with animator.setBool(“NameParameter”, Bool).

That line make the player return to the state idle.

if i commented, the player fleets. Also parameters can used in conditions (in a arrows) to return state and in code you call the animator state to change a parameter.

I hope I have helped you with something :D.

Thanks @GregSmash, however I already tried using, parameters, even without exit time or exit duration on the animation, it still returns to Jump first…