ragdoll: hoof don't keep it's rotation if it is the only hoof on the ground

Hi anyone,

I have finished the rotation of the leg, so far so good. Now I had the problem, that not the hoof rotates the rig(armature) because the rig did let rotate the hoof slide it’s rotation in the z-axis.
To resolve this I have writen a script, but it don’t work correctly. It rotates the rig only the half rotation of the hoof.
Therefore I have used propertys to have more controll. It don’t helps realy.
Now I need help to resolve this problem.

Can anyone have a look on the following file, to explay me what I do wrong, please?

Best regards, Arne.