Align foot to surface script.

Hi ! :cool:
I tried to make a script that will align foot to the surface but it doesnt work correctly so
im asking for help. I was inspired by Matt_Goles to write this script and basically its a connection of 2 scripts by Social and script for moving bones by Matt_Goles :eyebrowlift:
So the script works but foots update too slow and rotate only in one direction thats the main problem.:frowning: I attached an easy test scene.

PS. Sory for my english

Now it also align foot Z position to slope


test.blend (319 KB)

This is a nice feature please help

Well i am a rookie so i am not the one who is going to solve your problems but I did something like that with constraints once (NO PYTHON AT ALL) however what i aligned was the object not the bones. I made a character go up and downhill with constraints only and the object rotated, but if you want more than that (and you surely do) wait for one of the Gurus here to answer you XD. Maybe i am underestimating your knowledge with this but check this blend using constraints.

ConstraintEx.blend (198 KB)

Press Arrow Keys to move the cube

You should keep the calculation relative to the objects orientation. because it works fine if you rotate left (along X) and the opposite way if you rotate right (along -X).

Your script does not care the orientation of the owner. You have to somehow include it into your calculation. I think when you calculate the rotation matrix out of the hit normal.

@K11 Thats not exacly what i wanted but it might help
@Monster ill try that
Thanks for your replies

I finally did it ! :yes:
Hereโ€™s the blend file.


test.blend (303 KB)

NICE work dude :smiley: