Page 1 of 1

Mesh Help Pls

Posted: Sat Jan 26, 2008 2:22 am
by Easy Target
Hi, I've tried creating a mesh for my new map, and i think i've done everything right, but when i try to test my map, the mesh wont appear. Can someone tell me what i've done wrong with the mesh, and then post how the mesh SHOULD look... thanks

Code: Select all

mesh
	vertex 18 -51 0
	vertex 18 -47 0
	vertex 18 -47 26.5
	vertex 18 -51 26.5
	vertex -18 -47 0
	vertex -18 -47 26.5
	vertex -18 -51 0
	vertex -18 -51 26.5
	face
	vertices 4 5 6 7
	drivethrough
	shootthrough
	matref wall
	endface
	face
	vertices 0 1 2 3
	matref wall
	endface
	face
	vertices 0 1 4 6
	drivethrough
	matref wall
	endface
	face
	vertices 2 3 5 7
	matref wall
	endface	
end

Posted: Sat Jan 26, 2008 3:27 am
by Joe-Schmoe
Lets look at just one face for now:

Code: Select all

   vertex -18 -47 0
   vertex -18 -47 26.5
   vertex -18 -51 0
   vertex -18 -51 26.5
   face
   vertices 4 5 6 7
   drivethrough
   shootthrough
   matref wall
   endface
You have to imagine the square in your mind...you start at one corner, and move along each edge.

The way you have it, the face starts at vertex #4, -18 -47 0.

Next, it moves to vertex #5, which is directly above vertex #4.

The problem arises with the next vertex. It is diagonally across from #5. This means the program will try to connect #5 and #6. This would be fine if you wanted a triangle, but when you are making a square, the points have to be in order.

So: if you switch vertices #6 and #7, it should work.

Code: Select all

   vertex -18 -47 0
   vertex -18 -47 26.5
   vertex -18 -51 26.5
   vertex -18 -51 0
   face
   vertices 4 5 6 7
   drivethrough
   shootthrough
   matref wall
   endface

Posted: Sat Jan 26, 2008 4:38 am
by Easy Target
when i tested it, the mesh still wouldnt appear where i wanted it... i dont know what to do :(

Posted: Sat Jan 26, 2008 5:03 am
by Triumph of the Soul
If the mesh is working, but the position is wrong, just use the shift function to change it. I tested it with the changes Schmoe made and it still didn't work (well, one side worked), so the other 5 sides still have their vertices out of order. I would suggest drawing your points out on paper before hand to see if it helps you gain a better understanding of 3D geometry. I'm almost sure it would help you get your vertices in order. Once you become proficient with this (or once you start using a 3D modeler) you won't need paper (I still use paper by the way, because these modelers confuse the shenanigans out of me).

Posted: Sat Jan 26, 2008 5:19 am
by Easy Target
ok, i'll try that, I'll start over with my thing, and i'll draw it on paper first, before i input into my comp, thanks! 8)

Posted: Sat Jan 26, 2008 6:40 am
by Easy Target
ok, i've figured out what i did wrong, i didnt have any groups, and i had the stuff in the wrong quadrants. one minor problem though. When i tested the map, my texture came out sideways, any idea how to make it so that my texture matches the rest of the walls?

Code: Select all

define wall

material
name wall
	texture boxwall
	diffuse 0.68 0.68 0.68 0.68
end

mesh
	vertex -18 51 1
	vertex -18 47 1
	vertex 18 51 1
	vertex 18 47 1
	vertex -18 51 0
	vertex -18 47 0
	vertex 18 51 0
	vertex 18 47 0
	face
	vertices 1 5 7 3 
	shootthrough
	drivethrough
	matref wall
	endface
end

enddef

group wall
	position 0 -94 0
	size 1 1 26
end

Posted: Sat Jan 26, 2008 4:27 pm
by Joe-Schmoe
There is a great thread about how to do that here:

http://my.bzflag.org/bb/viewtopic.php?t ... =texcoords

Posted: Sat Jan 26, 2008 7:51 pm
by Tedius
I think you can avoid having to use texcoords if you name the "bottom" vertices of your face first. That is, start in the lower left-hand corner when you create your face.

Code: Select all

material 
name wall 
   texture boxwall 
   diffuse 0.68 0.68 0.68 0.68 
end 

define wall 
mesh 
   vertex -18 51 1     #0 labeling your vertices is fun and easy
   vertex -18 47 1     #1
   vertex 18 51 1      #2
   vertex 18 47 1      #3
   vertex -18 51 0     #4
   vertex -18 47 0     #5
   vertex 18 51 0      #6
   vertex 18 47 0      #7

   face 
     vertices 5 7 3 1 
     shootthrough 
     drivethrough 
     matref wall 
   endface 
end 

enddef 

group wall 
   position 0 -94 0 
   size 1 1 26 
end 

It has been a while since I have done this, so correct me if I'm wrong.

Posted: Sun Jan 27, 2008 4:01 am
by Easy Target
THANK YOU!
thank you guys so much. I finally figured out how to do it.