1 registered members (AndrewAMD),
1,375
guests, and 8
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Welding separate meshes
#417297
02/11/13 12:38
02/11/13 12:38
|
Joined: Jul 2005
Posts: 187
lostzac
OP
Member
|
OP
Member
Joined: Jul 2005
Posts: 187
|
I have two separate entities that I would like to sew together, I know how to deform the mesh that is not the issue...Other then going through med and getting the vertex number of model a and the vertex number of model b, is their a way to use vertex a position and run a trace to model b and return the results ?
I am trying to weld two seams together. The model was one that has been broke into two pieces to make it easier to handle, and I want to weld the seams together without having to code in each vertex if that makes sense
Last edited by lostzac; 02/11/13 12:39.
John C Leutz II
|
|
|
Re: Welding separate meshes
[Re: MasterQ32]
#417300
02/11/13 12:51
02/11/13 12:51
|
Joined: Jul 2005
Posts: 187
lostzac
OP
Member
|
OP
Member
Joined: Jul 2005
Posts: 187
|
Thanks for the quick response...to make sure I understand... I would get the position of vert a, then use a search on the second mesh to see if a corresponding vert is within x distance of Vert a, if it is then move it to vert a's position...
John C Leutz II
|
|
|
Re: Welding separate meshes
[Re: MasterQ32]
#417302
02/11/13 13:02
02/11/13 13:02
|
Joined: Jul 2005
Posts: 187
lostzac
OP
Member
|
OP
Member
Joined: Jul 2005
Posts: 187
|
Thanks for the logic..I am working on the code now...will post if I get it working
John C Leutz II
|
|
|
Re: Welding separate meshes
[Re: lostzac]
#417308
02/11/13 14:10
02/11/13 14:10
|
Joined: Jul 2005
Posts: 187
lostzac
OP
Member
|
OP
Member
Joined: Jul 2005
Posts: 187
|
function actor_sew(ENTITY*e1,ENTITY*e2)
{
var vert_count_a = ent_status(e1,0);
var vert_count_b = ent_status(e2,0);
var i;
var j;
// CONTACT* c1 = ent_getvertex(e1,NULL,823);
// CONTACT* c2 = ent_getvertex(e2,NULL,399);
//
// var distance = vec_dist(c1.x,c2.x);
//
// STRING* str_disr = "#255";
// str_for_num(str_disr,distance);
// printf(_chr(str_disr));
for(i=0;i<vert_count_a;i++)
{
CONTACT* c1 = ent_getvertex(e1,NULL,i);
for(j=0;j<vert_count_b;j++)
{
CONTACT* c2 = ent_getvertex(e2,NULL,j);
if(vec_dist(c1.x,c2.x) < 0.01)
{
c1.v = NULL;
c1.x = c2.x;
c1.y = c2.y;
c1.z = c2.z;
ent_setvertex(e1,c1,i);
}
}
}
ent_fixnormals(e1,0);
c_updatehull(e1,0);
}
That is the code so far, but something is wrong, or I am missing something I should say...I know the distance is right as I ran a check on two vertex that are suppose to match up (The commented out part of the code)..but when I run this Model B disappears completely...(Im assuming it is moving all the vertex to one position of that model)...I also know it is this function as when I checked for that as well.....any Ideas..I am sure it is something I am just overlooking
John C Leutz II
|
|
|
Re: Welding separate meshes
[Re: lostzac]
#417310
02/11/13 14:28
02/11/13 14:28
|
Joined: Jul 2005
Posts: 187
lostzac
OP
Member
|
OP
Member
Joined: Jul 2005
Posts: 187
|
Solved it..was the distance....should be 0.02..works fine now...thank you again for the pointer in the right direction
John C Leutz II
|
|
|
|