Difference between revisions of "BSP (File Format)"
Jump to navigation
Jump to search
(Add one more field, and use bu16 for boolean values stored as an u16) |
m (Correction from static analysis (stebler apparently was also aware of this from what I see in the physics engine article)) |
||
(12 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
− | '''BSP''' is a file format that contains vehicle collision data. BSP files are found in the bsp directory in [[Filesystem/Race/Common.szs| | + | '''BSP''' ('''B'''inary '''S'''ettings and '''P'''hysics) is a file format that contains vehicle collision data. BSP files are found in the ''bsp'' directory in [[Filesystem/Race/Common.szs|Common.szs]]. |
== File Format == | == File Format == | ||
{|class=wikitable | {|class=wikitable | ||
− | |||
! Offset !! Type !! Description | ! Offset !! Type !! Description | ||
|- | |- | ||
− | | 0x00 || f32 || Initial | + | | 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. | | 0x04 || hitbox[16] || An array of 16 hitboxes. | ||
Line 14: | Line 13: | ||
| 0x190 || vec3 || Second cuboid dimensions for the inertia tensor, with mass 12. | | 0x190 || vec3 || Second cuboid dimensions for the inertia tensor, with mass 12. | ||
|- | |- | ||
− | | 0x19c || f32 || A | + | | 0x19c || f32 || A multiplier applied to the angular velocity component computed from kart rigid body dynamics. |
|- | |- | ||
| 0x1a0 || f32 || {{Unknown-left|'''Unknown'''.}} | | 0x1a0 || f32 || {{Unknown-left|'''Unknown'''.}} | ||
Line 22: | Line 21: | ||
| 0x1d0 || wheel || For bikes, the back wheel. For karts, the back 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 | + | | 0x1fc || wheel[2] || Unused. For karts, the game reuses the two previous definitions with a negated X position. |
|- | |- | ||
− | | 0x254 || f32 || | + | | 0x254 || f32 || Maximum vertical distance of the vehicle body's rumble animation. |
|- | |- | ||
− | | 0x258 || f32 || | + | | 0x258 || f32 || Speed of the vehicle body's rumble animation. |
|- | |- | ||
| 0x25c || colspan=2 {{unknown|End of file.}} | | 0x25c || colspan=2 {{unknown|End of file.}} | ||
Line 34: | Line 33: | ||
{| class="wikitable" | {| class="wikitable" | ||
|+ hitbox substructure | |+ hitbox substructure | ||
− | |||
! Offset !! Type !! Description | ! Offset !! Type !! Description | ||
|- | |- | ||
− | | 0x00 || bu16 || Enable. | + | | 0x00 || bu16 || Enable flag. |
|- | |- | ||
| 0x02 || u16 || Padding. | | 0x02 || u16 || Padding. | ||
Line 47: | Line 45: | ||
| 0x14 || bu16 || Only collide with walls. | | 0x14 || bu16 || Only collide with walls. | ||
|- | |- | ||
− | | 0x16 || u16 || | + | | 0x16 || u16 || Tire collision index. |
|- | |- | ||
| 0x18 || colspan=2 {{unknown|End of substructure.}} | | 0x18 || colspan=2 {{unknown|End of substructure.}} | ||
Line 54: | Line 52: | ||
{| class="wikitable" | {| class="wikitable" | ||
− | |+ | + | |+ Wheel Substructure |
− | |||
! Offset !! Type !! Description | ! Offset !! Type !! Description | ||
|- | |- | ||
− | | 0x00 || bu16 || Enable. | + | | 0x00 || bu16 || Enable flag. |
|- | |- | ||
| 0x02 || u16 || Padding. | | 0x02 || u16 || Padding. | ||
|- | |- | ||
− | | 0x04 || f32 || Suspension | + | | 0x04 || f32 || Suspension spring stiffness. It multiplies the distance between the current position and the bottommost position. |
|- | |- | ||
− | | 0x08 || f32 || Suspension factor | + | | 0x08 || f32 || Suspension damping factor. It multiplies the wheel speed on the vertical axis. |
|- | |- | ||
− | | 0x0c || f32 || | + | | 0x0c || f32 || Maximum suspension travel. This value is the distance between the topmost and the bottommost wheel positions. |
|- | |- | ||
− | | 0x10 || vec3 || | + | | 0x10 || vec3 || Suspension top (highest point the wheel can reach when jouncing). For bikes' front wheel, this is relative to the handle position and rotation from [[bikePartsDispParam.bin]]. |
|- | |- | ||
− | | 0x1c || f32 || Wheel | + | | 0x1c || f32 || Wheel X rotation. Always zero. |
|- | |- | ||
| 0x20 || f32 || Wheel radius. | | 0x20 || f32 || Wheel radius. | ||
Line 80: | Line 77: | ||
| 0x2c || colspan=2 {{unknown|End of substructure.}} | | 0x2c || colspan=2 {{unknown|End of substructure.}} | ||
|} | |} | ||
+ | |||
+ | == Tools == | ||
+ | The following tools can handle BSP files: | ||
+ | * [[BSP Table]], by [[Atlas]] | ||
[[Category:File Format/MKW]] | [[Category:File Format/MKW]] |
Latest revision as of 17:52, 19 November 2023
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 multiplier applied to the angular velocity component computed from kart rigid body dynamics. |
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. |
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. |
Offset | Type | Description |
---|---|---|
0x00 | bu16 | Enable flag. |
0x02 | u16 | Padding. |
0x04 | f32 | Suspension spring stiffness. It multiplies the distance between the current position and the bottommost position. |
0x08 | f32 | Suspension damping factor. It multiplies the wheel speed on the vertical axis. |
0x0c | f32 | Maximum suspension travel. This value is the distance between the topmost and the bottommost wheel positions. |
0x10 | vec3 | Suspension top (highest point the wheel can reach when jouncing). 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: