Posted By: Rackscha
Small problem in Ragdoll code(orientation of Player) - 11/18/09 21:21
HI,
Since my last try for a ragdoll code, i have changed some things.
This is the code used to rotate a bone according to its physic bonde:
This is working as long as the mainbody's orientation(this hinge is connected to) is (0,0,0). How do i use now the orientation of the main body to calculate the correct angles?
As you can see, the bonemovement of the anim-bone and the physic-bone is fitting...but only as long as the main body(the big white block) has an orientation of (0,0,0). I know i have to use its orientation in my code but untill now i couldnt get it to work(maybe iam too tired).
I think until now, i did everything correct this time(ok still need to calculate with the main bodies orientation)
NAd yes i seacrhed through the forum,(and my old topicy) but couldnt find a solution for the thing iam imagine .
Maybe someone can give me a hint to add the calculation of the mainbody.
EDIT: i think i have to subtract the angle of the mainbody from the rotation of the physic-bone to get the local rotation right? And it hink i have to use matrices? But how?
Greets
Rackscha
Since my last try for a ragdoll code, i have changed some things.
This is the code used to rotate a bone according to its physic bonde:
Code:
vec_set(ang_b.pan,parent_ent2.pan); str_cpy(source_bone,source_bone_input); while(ent.skill1 == 0) { ang_diff(ang_a.pan,parent_ent2.pan,ang_b.pan); //calculate difference between old and new rotation of the physic-bone vec_set(ang_b.pan,parent_ent2.pan); ent_bonerotate(ent,source_bone,ang_a.pan);//rotate the anim-bone by the angular difference we got 2 lines above wait(1); }
This is working as long as the mainbody's orientation(this hinge is connected to) is (0,0,0). How do i use now the orientation of the main body to calculate the correct angles?
As you can see, the bonemovement of the anim-bone and the physic-bone is fitting...but only as long as the main body(the big white block) has an orientation of (0,0,0). I know i have to use its orientation in my code but untill now i couldnt get it to work(maybe iam too tired).
I think until now, i did everything correct this time(ok still need to calculate with the main bodies orientation)
NAd yes i seacrhed through the forum,(and my old topicy) but couldnt find a solution for the thing iam imagine .
Maybe someone can give me a hint to add the calculation of the mainbody.
EDIT: i think i have to subtract the angle of the mainbody from the rotation of the physic-bone to get the local rotation right? And it hink i have to use matrices? But how?
Greets
Rackscha