I am working for a while on a armature model which I wanna control by a script (obviously - a complicated one) so that the armature applied to a human-like mesh to “work” correctly as it is in reality. I know there are some scripts like Walk-o-matic but the latter work quite differently of the natural human movements so I need a new (better) one I also know that my model can be simplified but for historical reasons I keeping it unchanged so far. Finally, I know that some names of bones can be changed as there are more precise English terms for that but due to the reasons mentioned above Im keeping the names unchanged too!
Here is a front view of the armature so the leg next to Transform Properties square is the left one. As shown, the left leg is in its initial position while the right one has some rotations applied already. In initial position the legs step on the plane Z=0, ok? I now concentrate only on the legs cause problems above may get similar. I have taken precise positions on bones in their initial positions from a girl so I am sure that hips, knees, ankles, etc. are placed where they need to be!
What happens? I wanna calculate beforehand bones rotations so that the girl walks. If I takes rotation values of a moving human I will have the data but I’d like to make the opposite in order to control the walking and not record movements. TO be sure that my calculations are OK, I introduced a number of pointers. The scripts moves and rotates them so that pointers show where the ends of bones go. The problem is that pointers does not stick precisely to the bones and while there is a great deviation (0.1-0.2 Blender units or more) I cannot be sure that my calcs are precise. Here is hip bone + a magnified end to the right. The pink is end of the pointer with is a basic mesh (here only armature and the pointers are shown):
So you see there is a very small deviation from pointer to the end of left hip bone. I use rotation angles of 30 or -30 degrees just to simplify calculations in this case.
Here are situations with left thigh and the part below the knee (I named it “Leg_Down”):
You see - there are more visible deviations while the same size, shape, scale, dimentions and rotations are applied to the pointers and each pointer starts at the end of the previous one. The first pointer (po_Hip_L) starts at the Base point (see location of the 3D cursor at the first pic above). My task is to close the set with touching the ground (or calculate how high off the ground is the foot), OK
Results of calcs so far (showing correctly calculated values and the differences):
ob_Base_loc = (-2.5408000946044922, 0.0, 9.8000001907348633) pt_Base = [-2.540800, 0.000000, 9.800000](vector) ====== ai_Hip_L ======================================================================================= valW,valX,valY,valZ = [0.93301266431808472, 0.25, -0.25, 0.066987298429012299] q_Hip_L = [0.933013, 0.250000, -0.250000, 0.066987](quaternion) eu_Hip_L = [30.000000, -29.999996, -0.000000](euler) mat_Hip_L = [0.866025, -0.000000, 0.500000, 0.000000](matrix [row 0]) [-0.250000, 0.866025, 0.433013, 0.000000](matrix [row 1]) [-0.433013, -0.500000, 0.750000, 0.000000](matrix [row 2]) [-2.540800, 0.000000, 9.800000, 1.000000](matrix [row 3]) pt_H_local = (0, 1.2, 0) pt_Hip_L_end = [-2.840800, 1.039230, 10.319615](vector) po_Hip_L_co = [-2.840800, 1.039230, 10.319615](vector) ====== ai_Thigh_L ======================================================================================= valW,valX,valY,valZ = [0.93301266431808472, -0.25, -0.066987298429012299, 0.25] q_Thigh_L = [0.933013, -0.250000, -0.066987, 0.250000](quaternion) eu_Thigh_L = [-29.999996, 0.000000, 29.999996](euler) mat_Thigh_L = [0.500000, -0.000000, 0.866025, 0.000000](matrix [row 0]) [-0.000000, 1.000000, 0.000000, 0.000000](matrix [row 1]) [-0.866025, -0.000000, 0.500000, 0.000000](matrix [row 2]) [-2.840800, 1.039230, 10.319615, 1.000000](matrix [row 3]) pt_Thigh_local = (0, 0, -5) pt_Thigh_L_end = [1.489327, 1.039231, 7.819615](vector) po_Thigh_L_co = [1.489327, 1.039231, 7.819615](vector) ====== ai_Leg_Down_L ======================================================================================= valW,valX,valY,valZ = [0.86602538824081421, 0.5, 0.0, 0.0] q_Leg_Down_L = [0.866025, 0.500000, 0.000000, 0.000000](quaternion) eu_Leg_Down_L = [60.000000, -0.000000, 0.000000](euler) mat_Leg_Down_L = [1.000000, -0.000000, -0.000000, 0.000000](matrix [row 0]) [0.000000, 1.000000, 0.000000, 0.000000](matrix [row 1]) [0.000000, -0.000000, 1.000000, 0.000000](matrix [row 2]) [1.489327, 1.039231, 7.819615, 1.000000](matrix [row 3]) pt_Leg_Down_local = (0, 0.20000000000000001, -4) pt_Leg_Down_L_end = [1.489326, 1.239231, 3.819615](vector) po_Leg_Down_L_co = [1.489326, 1.239216, 3.820674](vector)
Looking at end of Thigh section - pt_Thigh_L_end is calculated position of the knee on the basis of starting point of the Thigh and its matrix; po_Thigh_L_co - the coordinate of the pointer which is also supposed to point at the knee…
Soooo… my questions are:
Where does this difference come from? Any ideas…?
Is there a way to find (or set) locations of head/tail of bones by a script? --> so far my script sets rotation values in bones Ipo curves and this works but NOT for the purposes I want…