Box Object
Work In Progress
We are working on updating and improving this documentation. Some information may be missing or inaccurate.
Description
One of the oldest supported objects, boxes are used in the vast majority of worlds to create obstacles, platforms, and structures. BZFlag 2.0 added materials, physics drivers, per-face settings, and the ability to control the texture size and texture offset. When any of those new 2.0 attributes are used, the box becomes what is known as a "new" box or a "meshified" box (not to be confused with the meshbox).
Old style boxes allow a tank to drive over (a.k.a. "bump up") small height differences, dictated by the _maxBumpHeight
server variable, which defaults to 0.33. Both new boxes and meshboxes do not yet support this feature.
When driving through a box with Oscillation Overthruster or a zoned Phantom Zone flag, the visual effects look different in the old box compared to either the new box or the meshbox. The old box makes the side of the box transparent, dims the screen a bit, and shows colored triangles inside the box. Both the new box and the meshbox instead make the walls semi-transparent and show a solid bottom.
| Type | Inside with OO or Zoned PZ | Bump Up support |
|---|---|---|
| Old box | Old style with triangle particles | Yes |
| New box | Transparent sides with solid floor | No |
| Meshbox | Transparent sides with solid floor | No |
Attributes
The box object supports the following attributes:
| Syntax | Description |
|---|---|
| name <name> |
Sets the name of this object. In many cases, this does not have any purpose and may just be useful for documenting what the object is for. In some case, like for teleporters, this can be used to reference the object from other objects. |
| position <x> <y> <z> |
This controls the absolute position of the object, lined up with the bottom center of the object. The center of the world, at ground level, is 0 0 0. |
| size <x> <y> <z> |
This controls the size of the object. It accepts three floating point numbers for the X, Y, and Z size of the object. Z is up. |
|
rot <angle> rotation <angle> |
Objects can be rotated on the Z axis, with the angle being specified in degrees. Extremely old worlds may use radians and will need to be converted, since BZFlag 1.7e0 used radians, and this was changed to use degrees in BZFlag 1.7e4. |
| shift <x> <y> <z> |
This shifts the relative position of an object. |
| scale <x> <y> <z> |
This scales an object up or down in the x, y, and/or z direction, with 1 being 100%. |
| shear <x> <y> <z> | |
| spin <angle> <x> <y> <z> | |
| xform <transform_name> |
The xform attribute applies the transformations of a transform to an object. You provide the name of the transform object. |
| drivethrough |
This allows tanks to drive through the object. |
| shootthrough |
This allows bullets and beam weapons to pass through the object. |
| passable |
This combines the effects of both the drivethrough and shootthrough attributes. |
| ricochet |
On a server with ricochet disabled, this attribute selectively enables ricochet on this object. |
| texsize <float> <float> | |
| texoffset <float> <float> | |
| phydrv <driver_name> |
Applies a physics driver named as provided, which alter the physics of a tank when they touch the object. Examples of physics drivers are bounce pads, conveyor belts, and death. You provide the name of the physics driver object. |
| matref <material_name> |
The matref attribute applies a material to the object. You provide the name of the material object. |
| resetmat | |
| dyncol <dynamic_color_name> | |
|
ambient <red> <green> <blue> [alpha] ambient <color_name> [alpha] |
|
|
diffuse <red> <green> <blue> [alpha] diffuse <color_name> [alpha] color <red> <green> <blue> [alpha] color <color_name> [alpha] |
|
|
specular <red> <green> <blue> [alpha] specular <color_name> [alpha] |
|
|
emission <red> <green> <blue> [alpha] emission <color_name> [alpha] |
|
| shininess <float> | |
| alphathresh <value> | |
| noculling | |
| nosorting | |
| noradar | |
| noshadow | |
| nolighting | |
| occluder | |
| groupalpha | |
| texture <texture_name> | |
| notextures | |
| addtexture <texture_name> | |
| texmat <matrix_name> | |
| notexalpha | |
| notexcolor | |
| spheremap | |
|
x+ <attribute> <value...> x- <attribute> <value...> y+ <attribute> <value...> y- <attribute> <value...> z+ <attribute> <value...> z- <attribute> <value...> top <attribute> <value...> bottom <attribute> <value...> sides <attribute> <value...> outside <attribute> <value...> |
These allow for setting some attributes on only certain sides of the box. The "sides" and "outside" are shortcuts that refer to the x+, x-, y+, and y- sides. The supported attributes are shootthrough, ricochet, texsize, texoffset, phydrv, matref, resetmat, dyncol, ambient, diffuse, color, specular, emission, shininess, alphathresh, noculling, nosorting, noradar, noshadow, nolighting, occluder, groupAplha, texture, notextures, addtexture, texmat, notexalpha, notexcolor, spheremap, shader, addshader, and noshaders. The drivethrough and passable attributes, while technically allowed to be set per-side, exhibit unusual behavior and should be only be set on the entire box, not on individual faces. |
Syntax Examples
This creates an old style box with the center of the bottom positioned at x = 10, y = 10, z = 10. Keep in mind that the Z axis is up, so this box will be positioned on the ground. Another important note is that the X and Y sizes are doubled, so this box will be 20 units wide in the X direction, 40 units wide in the Y direction, but only 10 units high.
box
position 10 10 0
size 10 20 10
end
This content is maintained on GitHub. We welcome any feedback and improvements!