BSP (File Format)

From Custom Mario Kart
Jump to navigation Jump to search

BSP (Binary Settings and Physics) is a file format that contains vehicle collision data. BSP files are found in the bsp directory in Common.szs.

File Format

Offset Type Description
0x00 f32 Initial Y position. If a collision is found, the normal to the floor multiplied by this value is added to the position from the KMP.
0x04 hitbox[16] An array of 16 hitboxes.
0x184 vec3 First cuboid dimensions for the inertia tensor, with mass 1.
0x190 vec3 Second cuboid dimensions for the inertia tensor, with mass 12.
0x19c f32 A value that also affects rotation speed.
0x1a0 f32 Unknown.
0x1a4 wheel For bikes, the front wheel. For karts, the front right wheel.
0x1d0 wheel For bikes, the back wheel. For karts, the back right wheel.
0x1fc wheel[2] Unused. For karts, the game reuses the two previous definitions with a negated X position.
0x254 f32 Maximum vertical distance of the vehicle body's rumble animation.
0x258 f32 Speed of the vehicle body's rumble animation.
0x25c End of file.


hitbox substructure
Offset Type Description
0x00 bu16 Enable flag.
0x02 u16 Padding.
0x04 vec3 Sphere center position.
0x10 f32 Sphere radius.
0x14 bu16 Only collide with walls.
0x16 u16 Tire collision index.
0x18 End of substructure.


Wheel Substructure
Offset Type Description
0x00 bu16 Enable flag.
0x02 u16 Padding.
0x04 f32 Suspension factor that multiplies the distance between the current position and the bottommost position.
0x08 f32 Suspension factor that multiplies the wheel speed on the vertical axis.
0x0c f32 Distance between the topmost and the bottommost wheel positions.
0x10 vec3 Wheel center position. For bikes' front wheel, this is relative to the handle position and rotation from bikePartsDispParam.bin.
0x1c f32 Wheel X rotation. Always zero.
0x20 f32 Wheel radius.
0x24 f32 Sphere radius used for collision detection. The difference between this value and the previous one is added to the wheel center to get the sphere center. 43 most of the time.
0x28 u32 Unknown.
0x2c End of substructure.

Tools

The following tools can handle BSP files: