Gamestudio Links
Zorro Links
Newest Posts
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 1,375 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19058 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Welding separate meshes #417297
02/11/13 12:38
02/11/13 12:38
Joined: Jul 2005
Posts: 187
L
lostzac Offline OP
Member
lostzac  Offline OP
Member
L

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: lostzac] #417299
02/11/13 12:41
02/11/13 12:41
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
do you want to weld or merge them?

to weld them:
you could go through every vertex in model one and and search for vertices in b which are in a given max. distance. if you found a vertex, move it to the vertex in a


Visit my site: www.masterq32.de
Re: Welding separate meshes [Re: MasterQ32] #417300
02/11/13 12:51
02/11/13 12:51
Joined: Jul 2005
Posts: 187
L
lostzac Offline OP
Member
lostzac  Offline OP
Member
L

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: lostzac] #417301
02/11/13 13:00
02/11/13 13:00
Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
MasterQ32 Offline
Expert
MasterQ32  Offline
Expert

Joined: Nov 2007
Posts: 2,568
Germany, BW, Stuttgart
yeah, exactly


Visit my site: www.masterq32.de
Re: Welding separate meshes [Re: MasterQ32] #417302
02/11/13 13:02
02/11/13 13:02
Joined: Jul 2005
Posts: 187
L
lostzac Offline OP
Member
lostzac  Offline OP
Member
L

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
L
lostzac Offline OP
Member
lostzac  Offline OP
Member
L

Joined: Jul 2005
Posts: 187
Code:
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
L
lostzac Offline OP
Member
lostzac  Offline OP
Member
L

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


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1