From BZFlagWiki
Revision as of 17:16, 12 September 2007 by Tedius (Talk | contribs) (drawInfo)

Jump to: navigation, search

A mesh is a BZW map object that defines an arbitrary three dimensional shape. A mesh is defined as a series of faces containing 3 or more points in three dimensional space ( or a vertex ).


The code for a mesh object is as follows, this is only an example

 name example_mesh
 # Material properties applied to a mesh apply to all faces
 # that follow the setting. Mesh faces will alter their own
 # properties without affecting the state of the mesh properties.
 # The same pattern is used to apply physics drivers.
 inside 5.5 4.5 1.2 # add an inside point (repeatable) 
 outside 0 0 1000 # add an outside point (repeatable) 
 vertex 100 200 300 # add a vertex (repeatable) 
 normal 1.0 0 0 # add a normal (repeatable) 
 texcoord 0.1 0.75 # add a texture coordinate (repeatable) 
 shift 0 0 0 # (repeatable) 
 scale 1 1 1 # (repeatable) 
 shear 0 0 0 # (repeatable) 
 spin angle nx ny nz # (repeatable) 
 phydrv example_phydrv # assign a physics driver 
 smoothbounce # ricochets use normals 
 noclusters # render each mesh face individually 
            # (this can be useful for occluders) 
 face # start a face (repeatable) 
      # faces must be convex polygons 
   vertices 1 4 0 3 5 # list of vertices (requires at least three) 
   normals 2 6 0 4 7 # list of normals (optional) 
   texcoords 0 3 2 4 9 # list of texture coordinates (optional) 
   phydrv example_phydrv # assign a physics driver 
 endface # end the face 
 #  This next element can be added to increase the rendering speed
 #  of the mesh object. If the client is capable of using this data,
 #  then it is used to draw the mesh instead of the face  information.
   dlist		      # display list for all material sets
   decorative		      # older clients with not see this mesh
   angvel <degrees/sec>       # rotation about initial Z axis
   extents <minX> <minY> <minZ> <maxX> <maxY> <maxZ>
   sphere <x> <y> <z> <radiusSquared>
   corner <v> <n> <t>	      (repeatable)
   vertex 0.0 0.0 0.0	      (repeatable)
   normal 0.0 0.0 0.0	      (repeatable)
   texcoord 0.0 0.0	      (repeatable)
   lod			      (repeatable)
     lengthPerPixel <value>
     matref <name>	      (repeatable)
       dlist		      # display list for this material set
       sphere <x> <y> <z> <radiusSquared>
       points	 0	      (repeatable)
       lines	 0 1	      (repeatable)
       lineloop  0 1	      (repeatable)
       linestrip 0 1	      (repeatable)
       tris	 0 1 2	      (repeatable)
       tristrip  0 1 2	      (repeatable)
       trifan	 0 1 2	      (repeatable)
       quads	 0 1 2 3      (repeatable)
       quadstrip 0 1 2 3      (repeatable)
       polygon	 0 1 2	      (repeatable)
     end  # matref
   end	  # lod
 end	  # drawInfo
end	  # mesh

Valid parameters for a mesh are

name The name of the mesh
vertex Add a vertex to the mesh (repeatable); this is a 'corner' of your mesh - a point where faces connect.
normal Add a normal to the mesh (repeatable)
texcoord Add a texture coordinate (repeatable); this is used for mapping textures onto complicated meshes.
phydrv Assign a physics driver to the entire mesh.
smoothbounce Ricochets use normals.
noclusters Render each face individually.
shift repeatable
scale repeatable
shear repeatable
spin repeatable
matref Assgn a material to all below faces.
face Start a face (repeatable), see below:

Valid parameters within the face sub-object:

verticies Numbered list of verticies for this face, requires at least three.
normals Numbered list of normals for this face.
texcoords Numbered list of texture coordinates for this face.
phydrv Assign a physics driver to this face only.
drivethrough Tanks can drive through this face.
shootthrough Tanks can shoot through this face.
passable Tanks can both shoot and drive through this face
matref Assign a material to this face.

Meshes have full support for Material (wherein custom textures can be defined) and Physics Drivers.


DrawInfo can be added to the mesh object to increase rendering efficiency, allowing the designer to specify which details will be seen from certain distances. It can also be used to rotate a mesh object, though tanks can not interact with the moving object.


The appearance of a mesh will vary greatly as by its very nature it can be defined to look like anything.

Editor Support

The mesh object is supported by the BZWTools blender plugin, the Wings3D Exporter or hand coding.


The Mesh object was added with the v2.0.0 release of BZFlag.