Here is code for a box with all the faces except the top set to drivethrough.
One interesting feature is that since the bottom of the box is
drivethrough, you can actually jump up through it, fall back down
and land on the top face. This is LouMan's jump through the floor
trick. Since you jump up *inside* the box, from the inside the faces
don't exist, you pass right through the top face from the inside. Once
outside, it exists underneath you, so you land on it.
Also, notice the face statement in the mesh below. See where it says
"vertices n n n n"? You need at least three vertices to make a face,
you can have as many vertices as you want in a given face statement,
but you can't make shapes that are concave, i.e. a face shaped like a
rectangle/parallellogram will work, but if you take that same shape
and yer pet poodle "Fluffy", comes up and takes a bite out of it, it won't.
The vertices also have to be "co-planar". Example: You can't
have three vertices that are at ground level and one up in the air.
In addition, the order in which you specify the vertices in the
face statement determine which way the face "faces". If your
tank is to the south of the box in the code below, facing north
and looking at the "back" face, the below statment of
"vertices 7 6 2 3" make it appear to be in front of you. But if you were to change the statment to say "vertices 3 2 6 7" (the exact reverse), then
the face wouldn't be visible except from inside the box. From your
point of view, it wouldn't exist. This "order of vertices specification"
thing is what is meant by the expression "face winding".
The below mesh is completely hand coded, so there are no normals
or tex coords. (I haven't gotten into the tex coord thing, as I have
absolutely no idea what they are for). The only thing I can say
about normals is that they are a theoretical line that is perpendicular
to a face. Example: Imagine a pole sticking straight out from the
center of each face of the box. That is a normal. In Blender, normals
appear to be used to keep track of which way the faces are facing.
I had a terrible time at first with Blender because I would export my
.obj file and run it through modeltool only to discover that some of
my faces weren't there. Then I discovered the UV face select mode
in Blender (still have absolutely no idea what UV means...)and was able to
"see" my missing faces and fix the problem by flipping the normal for the
missing face so it pointed the opposite way.
You can also have a "matref" statement inside each face statement.
Here is a wireframe of the box, with the vertices labeled:
The code:
options
-j
+r
end
world
size 50
end
define box
# front = north
mesh
vertex -10 10 0 # 0 lower left corner front
vertex -10 10 10 # 1 upper left corner front
vertex -10 -10 10 # 2 upper left corner rear
vertex -10 -10 0 # 3 lower left corner rear
vertex 10 10 0 # 4 lower right corner front
vertex 10 10 10 # 5 upper right corner front
vertex 10 -10 10 # 6 upper right corner rear
vertex 10 -10 0 # 7 lower right corner rear
# left side of box
face
vertices 3 2 1 0
drivethrough
endface
# front of box
face
vertices 0 1 5 4
drivethrough
endface
# right side of box
face
vertices 4 5 6 7
drivethrough
endface
# back of box
face
vertices 7 6 2 3
drivethrough
endface
# top of box
# NOT drivethrough
face
vertices 1 2 6 5
endface
# bottom of box - leave this part off to save
# a wasted face if the box is going to be on
# the ground
face
vertices 7 3 0 4
drivethrough
endface
end
enddef
# make a group of the box
# right now the box is 20 units by 20 units by 10 high
# use shift, spin and scale to put it where you want
group box
shift 0 0 5 # this puts it five units in the air
spin 45 0 0 1 # this spins it 45 degrees around the z axis
Scale .5 .5 .5 # make it 1/4 it's original size
end