Custom Track Tutorial/BCO

Programs: Subtutorials:
 * mkdd collision by Yoshi2 (converting)
 * Using mkdd-collision

Making Collision from a Model

 * Use the same workspace file for the collision and model. This makes it easier to make edits to both .bmd and .bco at once, if you should need to do so.
 * Clone all the meshes that are relevant to collision. This includes floors, boundaries, walls, offroad - any part of the model that the kart is going to interact with.
 * Edit the triangles until they are satisfactory
 * Walls need to be made horizontal by offsetting the driveable part of the collision.
 * Deadzones may need to be added.
 * Replace the textured materials with collision materials. A collision material takes the form "Roadtype_0xFlag_0xExtraSettings"
 * The "Flag" takes the form of four hex digits
 * The "ExtraSettings" take the form of 8 hex digits. The default is 0x00000000

General Tips
 * Collision triangles don’t move.
 * Remove ALL doubles and make sure no polygon overlaps. The game will react by taking only one of these overlapping polygons, and completely ignoring the other.
 * Delete all useless triangles. This is basically any triangle that the kart will not interact with and vertical triangles.
 * In fact, vertical triangles will cause the game to bug out and trigger basically and out of bounds.
 * Triangles that are too large can greatly increase file size, but there is a workaround that is seen later in the document.
 * The game does not handle long, steep triangles well. Any very steep section should be cut into smaller triangles.
 * Other triangles do not need to be cut into smaller triangles, in fact, needlessly splitting up triangles is a bad idea.
 * Export a collision model as .obj, as that is the only filetype that mkdd collision can work with
 * Do not worry about resetting XForms.

Collision Flags
A list of all collision flags can be found here. The more common/useful/notable ones will be described in more detail here.

Flags Walls - Flags that stop your movement  Deadzones / Teleportation - Flags that point to respawn points  Boosts - Flags that make you speed up 
 * First two digits give the function of the flag: 0x01__ is normal road, 0x12__ is wall, 0x00__ is mud, and 0x05__ is deadzone. All flags with the same first two digits will have the same properties in terms of driving over them.
 * The second two digits give other properties
 * For roads/walls, it differentiates different triangles for the purposes of sound and particles. The specific particle is determined by the course ID.
 * For deadzones, it determines which respawn point is used.
 * WALLS ARE HORIZONTAL, NOT VERTICAL
 * with the property that karts cannot go over edges of wall triangles unless another driveable collision flag is between the kart and the edge.
 * If a kart runs into a vertical TRIANGLE, they will be put back at the course starting point with the kart body and characters invisible.
 * Wall triangles extend upwards infinitely until stopped by another triangle.
 * Wall triangles should extrude at least 200 units from walls.
 * Neither players nor items can go over the edges of 0x02__ flags. Items can go over the edges of 0x12__ flags, but players cannot.
 * If you wish to make a wall that items (like shells) bounce off of, but get thrown over (like bananas), stack a 0x02__ triangle under a 0x12__ triangle.
 * You cannot simply have a big rectangle of 0x0200 flags underneath a course and have them work as regular walls, because it is the edges that matter.
 * As a general rule, below each ledge is a 0x02__ flag. Yoshi Circuit is a great example for this; under the edge triangles on the course, there are 0x02__ triangles. This keeps karts from clipping out of a ledge.
 * Rainbow Road and the bridge on Bowser Castle near the start are examples where there are no underlying 0x02__ triangles. Near the edges, it is possible to go under the course and then back on it due to this.
 * Walls or deadzones should surround the entire course, just like you designed earlier. This is to stop players from seeing outside the course / into the course when their kart is right up against it.
 * Deadzones are not out of bounds - deadzones refer specifically to collision triangles / areas that will put you back at a respawn point.
 * Out of Bounds refers specifically to a lack of collision that will put you back at the starting point.
 * The exact flag (the last two digits) determines which respawn point will be used. 
 * Deadzone Flags - These flags will take away your items.
 * 0x05__: these produce vertical lines when you fall into them / respawn
 * 0x0A__: these produce a circle, and are used when you are falling into air
 * 0x0E__: these produce the sand / falling animations, and are used only in Dry Dry Desert deadzone sand
 * 0x0F__: these are used when you fall into water / lava. They produce a wave line that rises.
 * In vanilla, these triangles are associated with GeoSplash objects in the .bol. However, due to problems with the conversion software, neither the wave lines nor the GeoSplash objects work in custom tracks.
 * 0x11__: these are the flags for Peach Beach sand, you don’t die if you go into them, but it determines the respawn point if you get killed by the dark water
 * Teleportation Flags - These flags will let you keep your items
 * 0x09__: Go super fast to the corresponding respawn point.
 * You need a GeoCannon object with the respawn point specified in its object settings in the .bol or the game will crash.
 * Also, the angle that the kart takes during its travel depends on the angle of the GeoCannon object.
 * 0x0D__: instant teleportation to the corresponding respawn point
 * 0x07__/ 0x47__ /0x37__: Zippers linked with a respawn point.
 * While these flags have an associated respawn point, your kart will still function like a normal zipper (0x0800) flag.
 * 0x020__ triangles surround all deadzones to prevent the player from going out of bounds, but this is not necessary for the game to function.
 * 0x08__: The basic boost
 * 0x09__: Explained above
 * 0x07__: Used on ramps - stops the falling animation from playing, (probably)
 * 0x37__/0x47__: Used on ramps - stops the falling animation from playing, (probably)

Additional Tags
When using v0.8.1 or later of mkdd collision, then additional information can be provided at the end of the material name. For most materials, this will be 0x00000000, resulting in a material name of Roadtype_0x0100_0x00000000 However, for materials with a collision flag of 0xF0__, the tag needs to be changed so that the material name is Roadtype_0x0100_0x5000010A where A is the index of the GeoSplash object. This will allow for the vanilla water / lava deadzone effect. The "1" may or may not be necessary. In vanilla, variations on the tags for non-0xF0__ flags do occur, but is currently undocumented.