This wiki is archived and useful information is being migrated to the main bzflag.org website
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(vertices) in three dimensional space.
The code for a mesh object is as follows, this is only an example
mesh name example_mesh # # Material properties and physics 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. # 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 smoothbounce noclusters drivethrough shootthrough passable matref endface # end the face # # The drawInfo 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. # end # mesh
Valid parameters for a mesh are:
|name||The name of the mesh.|
|vertex||this is a 'corner' of your mesh - a point where faces connect. (at least 3 are required).|
|normal||a unit vector describing the direction light will reflect off the object.|
|texcoord||this is used for mapping textures onto the mesh. This will link a point of the 2-Dimensional texture to a vertex on the 3-Dimensional object. (0,0) refers to the lower left corner of the texture, (1,1) refers to the top right. Textures are defined in the material object.|
|inside||an arbitrary vertex placed on the inside of the mesh object. This keeps tanks from driving or spawning inside the object.|
|phydrv||Assign a physics driver as defined in the physics object.|
|smoothbounce||shot will ricochet from the face in the same direction as the defined normal.|
|noclusters||Render each face individually.|
|shift||places the mesh using <x y z> coordinates.|
|scale||resizes the mesh along the x, y, or z axis.|
|spin||spins the mesh <angle> number of degrees, <n> number of rotations along one or more of the x, y, or z axis.|
|drivethrough||Tanks can drive through this mesh.|
|shootthrough||Tanks can shoot through this mesh.|
|passable||Tanks can both shoot and drive through this mesh.|
|matref||Assign a material to all below faces.|
|face||Start a face (required), see below.|
Valid parameters within the face sub-object:
- Numbered list of vertices for this face. (requires at least three)
- Numbered list of normals for this face.
- Numbered list of texture coordinates for this face.
- Assign a physics driver to this face only.
- use normals to determine shot ricochets for this face.
- Tanks can drive through this face.
- Tanks can shoot through this face.
- Tanks can both shoot and drive through this face
- Assign a material to this face.
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 shape of a mesh will vary greatly as by its very nature it can be defined to look like anything. Unless a material is defined and applied, the default "mesh.png" texture will be applied to all faces of the mesh.
mesh vertex -10 -10 0 vertex 10 -10 0 vertex 10 10 0 vertex -10 10 0 vertex -10 -10 10 vertex 10 -10 10 vertex 10 10 10 vertex -10 10 10 face #south vertices 0 1 5 4 endface face #east vertices 1 2 6 5 endface face #north vertices 2 3 7 6 endface face #west vertices 3 0 4 7 endface face #bottom vertices 0 1 2 3 endface face #top vertices 4 5 6 7 endface end #mesh
|Simple billboard with texcoords
mesh vertex -10 0 0 vertex 10 0 0 vertex 10 0 10 vertex -10 0 10 texcoord 0 0 texcoord 1 0 texcoord 1 1 texcoord 0 1 matref myBillboard face vertices 0 1 2 3 texcoords 0 1 2 3 endface face #backside vertices 1 0 3 2 texcoords 1 0 3 2 endface end #mesh
|Simple Jump-through floor
mesh vertex 0 0 9 vertex 10 0 9 vertex 10 10 9 vertex 0 10 9 vertex 0 0 10 vertex 10 0 10 vertex 10 10 10 vertex 0 10 10 face #south vertices 0 1 5 4 drivethrough endface face #east vertices 1 2 6 5 drivethrough endface face #north vertices 2 3 7 6 drivethrough endface face #west vertices 3 0 4 7 drivethrough endface face #bottom vertices 0 1 2 3 drivethrough endface face #top vertices 4 5 6 7 endface end #mesh
An inside point allows the mapper to make a mesh solid. This means that regardless of what the player tries to do, they will not be able to go through the object, or end up spawning inside a mesh unintentionally. When you drive through a box, especially with the Oscillation Overthruster flag, you will be inside of a building and sealed to it. Without inside points, especially to larger meshes, you will just end up on the inside of it and be able to shoot and drive normally. This is sometimes intentional, but usually not wanted. Inside points remedy this.
In order to have successful inside point coverage, you need to make sure all faces of your mesh are in "line of sight" to the point you specify. This means that all faces have direct vision to that point, just as if that point was a point of light and all the faces were eyes. Only what can be seen through a straight line will be considered the inside for that face.
The mesh object is supported by the BZWTools blender plugin, the Wings3D Exporter and hand coding.
The Mesh object was added with the v2.0.0 release of BZFlag.