KCL files define the collision data for a course in Mario Kart DS. The header takes the following structure:

OffsetTypeMeaning
0x00 VecFx32 * Pointer to vertex list (fixed up at runtime)
0x04 VecFx16 * Pointer to normal list (fixed up at runtime). These should be unit vectors.
0x08 void * Pointer to triangle data (fixed up at runtime). This list is 1-indexed, so this really points 0x10 bytes before the data.
0x0C void * Pointer to octree data (fixed up at runtime)
0x10 fx32 Prism thickness
0x14 VecFx32 Bounding minimum coordinate
0x20 u32[3] Area width masks { x, y, z }
0x2C u32[3] Area width shifts { x, y, z }
0x38 fx32 Collision sphere radius

The prism data in the file is stored in a way that makes collisions simpler to calculate. Prisms are derived from extruding a triangle by the prism thickness specified in the file header. Each triangle references one vertex from the vertex list. These triangles take the following structure:

OffsetTypeMeaning
0x00 fx32 Length
0x04 u16 Vertex index. This is the index of one of the vertices of the face in the vertex list.
0x06 u16 Surface normal index. Collision only works in one direction.
0x08 u16 Vector 1 index
0x0A u16 Vector 2 index
0x0C u16 Vector 3 index
0x0E u16 Collision attributes (see below)

Next in the file is the octree data. In order to accelerate the collision calculation process, octrees allow for the lookup time to be significantly reduced by recursively partitioning the model into equal-sized boxes. When the collision sphere is within an octree's bounds, only collision prisms within that box need to be checked. Because the collision sphere has a nonzero radius, the octree bounds should be inflated by its radius to create a box with rounded edges.

Collision Attributes#

The collision attributes as specified in the collision prism data determine what should happen when each face is collided. Its structure is a 16-bit bit field like the following:

BitsMeaning
1 Map2D shadow
2-3 Light ID (0-3)
4 Ignore drivers
5-7 Collision variant
8-12 Collision type
13 Ignore items
14 Is wall
15 Is floor

The following are the collision types used in Mario Kart DS:

TypeMeaning
0 Road
1 Slippery Road
2 Weak Offroad
3 Offroad
4 Sound Trigger
5 Heavy Offroad
6 Slippery Road 2
7 Boost Panel
8 Wall
9 Invisible Wall (ignored by cameras)
10 Out of Bounds
11 Fall Boundary
12 Jump Pad
13 Road (no drivers)
14 Wall (no drivers)
15 Cannon Activator
16 Edge Wall (does not collide when on the ground)
17 Falls Water
18 Boost Pad w/ Min Speed
19 Loop Road
20 Special Road
21 Wall 3
22 Force Recalculate Route

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-1) was last changed on 05-Jun-2024 11:44 by Garhoogin