bone to bone conection (two models)

Posted By: sebbi91

bone to bone conection (two models) - 02/10/10 16:44

hi

I have two different Models with much bones and i want to connect this both models with a script!

I want to connect the bone nr. 1 from my human-model with bone nr 1 from my hair-model.

And the same thing with bone 2 and 3!

Is there any way to make this possible
I tried this way :
Quote:



human_ent_p1= ent_create("player1.mdl",NULL,NULL);
human_ent_p1.pan=180;
human_ent_p1.scale_x=0.05;
human_ent_p1.scale_y=0.05;
human_ent_p1.scale_z=0.05;
human_ent_p1.z=50;
human_ent_p1.material = human_material;
set(human_ent_p1,SHADOW||OVERLAY);


//Define the bone points

//PLAYER-BONES
vec_for_bone (Player_Neck_pos_p1,human_ent_p1,"Neck_bone");
vec_for_bone (Player_Head_center_pos_p1,human_ent_p1,"Head_center_bone");
vec_for_bone (Player_Eye_center_pos_p1,human_ent_p1,"Eye_center_bone");



//Create the other parts of the human


hair_p1= ent_create("hair_short.mdl",NULL,NULL);
hair_p1.scale_x=0.05;
hair_p1.scale_y=0.05;
hair_p1.scale_z=0.05;


if(hair_p1==1)
{
//HAIR_BONES
vec_for_bone (Hair_Neck_pos_p1,hair_p1,"Neck_bone"); // Hair_Neck_bone_p1 = ent_create ("barrel.mdl",temp,NULL);
vec_for_bone (Hair_Head_center_pos_p1,hair_p1,"Head_center_bone"); // Hair_Head_center_bone_p1 = ent_create ("barrel.mdl",temp,NULL);
vec_for_bone (Hair_Eye_center_pos_p1,hair_p1,"Eye_center_bone"); // Hair_Eye_center_bone_p1 = ent_create ("barrel.mdl",temp,NULL);


}

...
while(1)
{
if(hair_p1)
{
vec_for_bone(hair_p1.x,human_ent_p1,"Head_center_bone"); // place gun at hand position

vec_for_bone(Hair_Neck_pos_p1.x,human_ent_p1,"Neck_bone"); // place gun at hand position
vec_for_bone(Hair_Head_center_pos_p1.x,human_ent_p1,"Head_center_bone"); // place gun at hand position
vec_for_bone(Hair_Eye_center_pos_p1.x,human_ent_p1,"Eye_center_bone"); // place gun at hand position

ang_for_bone(hair_p1.pan,human_ent_p1,"Head_center_bone"); // rotate gun by hand angle

// vec_for_bone(hair_p1.x,human_ent_p1,"Head_center_bone"); // place gun at hand position
// ang_for_bone(hair_p1.pan,human_ent_p1,"Head_center_bone"); // rotate gun by hand angle

}
..



regards sebbi
Posted By: maslone1

Re: bone to bone conection (two models) - 02/11/10 18:53

I think you wanna connect some bodyparts to each other,
and than do some script-rigging, don't you? Am i right?
Posted By: sebbi91

Re: bone to bone conection (two models) - 02/11/10 19:34

exact ^^
i have the player.mdl and the hair.mdl!
I create the player in my game and than i create the hair.mdl!
Now i want to stick them together!

bone 1 from the player.mdl with bone 1 from the hair.mdl.
bone 2 from the player.mdl with bone 2 from the hair.mdl.
bone 3 from the player.mdl with bone 3 from the hair.mdl.

and all this with a script!
But i cant get it working ^^

I hope you could help !

regards sebbi
Posted By: Progger

Re: bone to bone conection (two models) - 02/11/10 19:46

why you want to use bones and why you do not use vec_for_vertex?
WFG programmer
Posted By: sebbi91

Re: bone to bone conection (two models) - 02/12/10 16:03

because i have some different Playermodells with different numbers of vertices, and the same at the other modells like the hair!
my game should be a MORPG and so the player can select the hairstyle & the other parts like cloths,...

I thought the best way to make this system possible are bone to bone connections!
the bone names are the same only the modell must be changed!
And if i want to script 50 different kinds of model connections with vertices the script gets very worse big!

Any ideas?
Posted By: sebbi91

Re: bone to bone conection (two models) - 02/13/10 15:01

no ideas?
Posted By: MrGuest

Re: bone to bone conection (two models) - 02/13/10 15:26

i'd use vec_for_vertex, store each vertex in an array for the model type

though i don't see why you using a bone in the hair too, surely the hair.mdl coordinates for 0,0,0 should match the bone position?
Posted By: Progger

Re: bone to bone conection (two models) - 02/13/10 16:33

it will work with vec_for_vertex and ent_morph to change hairs etc.
WFG programmer
Posted By: sebbi91

Re: bone to bone conection (two models) - 02/13/10 16:43

ok I will try it ^^
THX a lot
Posted By: sebbi91

Re: bone to bone conection (two models) - 02/14/10 12:45

ok it works fine but only for the hair, the boots and the gloves! o.O

If i want to connect the t-shirt with the body and the trusers with the legs it doesn't work!
It's because the ragdoll!

If my player dies, the t-shirt and the trusers dindt move with the player!
At this point i realy need bone to bone conections!

I hope someone can help!


wfg Sebbi
Posted By: muffel

Re: bone to bone conection (two models) - 02/14/10 13:17

you need vec_for_bone and ent_bonemove

first of all i would set each frame the orgin of the T-shirt to the one of the player.
then you save the bone-position of the bones you want to move and the positions of the bone you want to use as target postion(the one of the player)
then you callculate the difference between the t-shirtbone position and the target bone position
at last you move the T-shirt-bone with this diggerence VECTOR

muffel hope you can understand this
Posted By: sebbi91

Re: bone to bone conection (two models) - 02/14/10 15:02

Ok i will give it a try ^^

thx

regard sebbi
© 2024 lite-C Forums