Small problem in Ragdoll code(orientation of Player)

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:

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 grin.

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
Posted By: Helghast

Re: Small problem in Ragdoll code(orientation of Player) - 11/24/09 16:34

create your ragdoll as if it had no rotation to setup the hinges properly, and apply post-rotation to the whole body.

later on you want to place the position of all objects on the position of the bones for blending animations anyway...

that's how I used to do it laugh
Posted By: Rackscha

Re: Small problem in Ragdoll code(orientation of Player) - 11/27/09 12:51

No,i meaned,when they body changes its orientation while acting like a ragdoll.
I didnt mean the startup.. The startup is currently always (0,0,0).


Iam not able to translate the global rotation of the Physic-bone to local rotation of the bone(if the orientation of the visible mesh is not (0,0,0) ).

Greets
Rackscha
Posted By: xXxGuitar511

Re: Small problem in Ragdoll code(orientation of Player) - 12/02/09 03:27

just read the angles of the hinge constraints and then rotate the models bone animations. Hinges are local values, and so are bones, you're doing unnecessary work.
© 2024 lite-C Forums