coastline 0.0.4
Loading...
Searching...
No Matches
physics.h File Reference

The physics of the vehicles: the forces on their bodies and wheels, the grip of the tyres, the suspension, and the collisions with the track and with each other. More...

#include <PR/ultratypes.h>
#include "common/rigidbody.h"
#include "common/tricache.h"
#include "common/vecmath.h"
Include dependency graph for physics.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  CollisionTriangleNode
 A node of the list of the triangles that cross the box of a body. More...
union  CollisionContactVector
 A contact plane with a vector view and its original four-component array view. More...

Macros

#define GRIP_WEATHERS   3
 The weathers the grip of a surface differs in: dry, rain and snow.
#define TRACK_SURFACES   8
 The surfaces of the track.
#define COLLISION_TRIANGLE_NODES   200
 The nodes of the list.
#define g_fCollisionContactW   (g_vCollisionContact.axis[3])
 The word after g_vCollisionContact, which ComputeCollisionPenetration() scales.

Typedefs

typedef struct CollisionTriangleNode CollisionTriangleNode
 A node of the list of the triangles that cross the box of a body.
typedef union CollisionContactVector CollisionContactVector
 A contact plane with a vector view and its original four-component array view.

Functions

void ResetCollisionCaches (void)
 Empty the cache of the triangles and the list of the triangles that cross the box.
void SumBodyForces (RigidBody *body)
 Add the forces of the list of a body to its sums of force and torque.
void SumWheelForces (RigidBody *body, RigidBody *wheel)
 Add the forces of a wheel, in the frame of the body, to the force of the wheel, and the turn of their part along the ground to the torque of the body while the wheel touches the ground.
void ComputeVehicleAccelerations (RigidBody *body)
 Turn the sums of the force and torque of the body of a vehicle, and the forces of its wheels, into its accelerations, left in the sums.
void ComputeVehicleForces (RigidBody *body)
 Sum the forces of the body of a vehicle and of its wheels, and turn them into its accelerations.
void ComputeWheelLocalVelocity (Vec3f *out, RigidBody *body, RigidBody *wheel)
 The velocity of the point of a body over a wheel at the height of the body, in the frame of the body.
void GetWheelWorldVelocity (Vec3f *out, RigidBody *body, RigidBody *wheel)
 The velocity of the point of a body at a wheel.
void GetBodyPointVelocity (Vec3f *out, RigidBody *body, Vec3f *point)
 The velocity of a point of a body, given in its frame.
void ApplySideGrip (RigidBody *body, f32 dt, f32 *rearLoad, f32 *frontLoad, u8 *rearSliding, u8 *frontSliding)
 Cancel the sideways slip of the rear and the front of the body of a vehicle as far as the grip of the tyres allows on their surfaces, and lean the body as it skids.
void DriveWheel (RigidBody *body, RigidBody *wheel, f32 *load, u8 *sliding, f32 dt)
 Drive a wheel on the ground, pushing the body along the way the wheel rolls by its drive, as far as the weight on it lets it, and spin and turn the wheel.
s16 IsPointInTrackTriangle (TrackTriangle *triangle, Vec3f *point)
 Whether a point lies within a triangle of the track, seen along the main axis of its normal.
f32 PlaneDistance (Vec3f *normal, f32 offset, Vec3f *point)
 The distance of a point from a plane.
s32 BounceOffPlane (RigidBody *body, Vec3f *normal, s32 damp, s32 spin)
 Stop the next step of a body moving into a plane, with a little bounce, record a hard hit, and damp its spin about the plane.
s32 UnusedCollisionResponseStub (void *body, void *normal, void *damp)
 An empty collision response.
s32 ApplyCollisionImpulse (RigidBody *body, Vec3f *point, Vec3f *normal, s32 friction, f32 restitution)
 Give the next step of a body the impulse at a point of it, in its frame, that stops the point moving into a surface, record a hard hit, and retain a part of the slide along the surface.
void PushCollisionTriangle (TrackTriangle *triangle)
 Add a triangle to the list of those that cross the box.
void PrintCollisionTriangleCount (void)
 Print the length of the list on the debug output.
s32 ClassifyTriangleInUnitCube (Vec3f triangle[3])
 Sort out a triangle against the unit cube by its corners and its edges.
s32 CountTriangleWinding (Vec3f triangle[3], Vec3f *normal, Vec3f *point)
 How many times a triangle winds about a point of its plane, seen along the main axis of its normal.
s32 DoesSegmentCrossUnitCube (Vec3f *start, Vec3f *end)
 Whether a segment passes through the unit cube.
s32 DoesTriangleCrossUnitCube (Vec3f triangle[3], Vec3f *normal)
 Whether an edge of a triangle, or a diagonal of the unit cube, crosses the other.
s32 IsTriangleInUnitCube (Vec3f triangle[3], Vec3f *normal)
 Whether a triangle crosses the unit cube.
s32 CollectTrianglesInBox (RigidBody *body, f32 box[4][4])
 List the triangles of the cache under a body that cross its box.
s32 UnusedTrackCollisionStub (void *body)
 An empty collision of a body with the track.
s32 TipBalancedVehicle (RigidBody *body)
 Roll a vehicle that stands still balanced on one or two wheels off its balance, printing what it finds on the debug output.
void ComputeCollisionPenetration (RigidBody *body, Vec3f *normal, f32 offset, Vec3f *contact, Vec3f triangle[3])
 Find how far the box of a body is into a triangle.
s32 CollideBodyWithTriangles (RigidBody *body, f32 box[4][4])
 Collide the next step of a body with the listed triangles that cross its box, and move it back out of those it hit.
void StepVehicleCollisions (RigidBody *body)
 Step the vehicle body through a frame, collide it, and count its upside-down frames.
void ComputeDragForce (RigidBody *body, RigidBodyForce *force)
 Set a force to the drag on the body of a vehicle, which grows on the surface that slows it.
f32 CastWheelRay (RigidBody *body, RigidBody *wheel)
 Find the ground below a wheel in the cache of the triangles.
void UpdateWheelHeights (RigidBody *body)
 Find the ground below each wheel of a vehicle, and hang each wheel to it, no more than 0.4 down.
void ComputeSpringForces (RigidBody *body)
 Set the springs of the wheels of a vehicle, and count the frames each wheel touches the ground.
void ComputeDampingForces (RigidBody *body)
 Set the dampers of the wheels of a vehicle on the ground.
s32 TestObbIntersection (f32 rotation[3][3], Vec3f *offset, Vec3f *halfA, Vec3f *halfB)
 Whether two boxes overlap, by the separating axes of their faces and of the products of their edges.
void CollideVehicles (void)
 Collide each pair of the vehicles of the race that are near, sharing their speed along the line between them and pushing them apart.

Variables

CollisionTriangleNode g_aCollisionTriangleNodes [COLLISION_TRIANGLE_NODES]
 The nodes available for the triangles crossing the box of a body.
CollisionTriangleNode * g_pCollisionTriangleList
 The list, the latest first.
CollisionTriangleNode * g_pNextCollisionTriangleNode
 The next free node.
s32 g_dwCollisionContactType
 How the last collision with a triangle is resolved: 1 against its plane alone, 2 at the face of the box nearest the triangle, otherwise at the corner of the box.
TrackTriangle * g_pCollisionTriangle
 The triangle of the last collision.
s32 g_bTrackCollisionFrameToggle
 Whether the triangles of the cache are collected from the last.
f32 g_afSurfaceGrip [GRIP_WEATHERS][TRACK_SURFACES]
 The grip of the tyres on each surface in each weather, the load below which they hold, and the load above which they hold no less.
f32 g_afSurfaceMaxLoad [GRIP_WEATHERS][TRACK_SURFACES]
 The tyre load at which the surface grip stops increasing, by weather and surface.
f32 g_afSurfaceSlipLoad [GRIP_WEATHERS][TRACK_SURFACES]
 The minimum tyre load used when calculating sliding grip, by weather and surface.
Vec3f g_vecUnitX
 The axes.
Vec3f g_vecUnitY
 The unit vector along the positive Y axis.
Vec3f g_vecUnitZ
 The unit vector along the positive Z axis.
Vec3f g_vecNegUnitZ
 The unit vector along the negative Z axis.
Vec3f g_vVehicleObbHalfExtents
 The half extents of the box two vehicles collide by.
CollisionContactVector g_vCollisionContact
 Where the last collision with the track touched the body, in its frame.
Vec3f g_vCollisionPenetration
 How far the last collision put the body into the triangle.
f32 g_fConst0p0001
 The restitution threshold for recording a hard collision.
f32 g_fConst0p9_3
 The velocity scale after a hard collision.
f32 g_fConst0p2
 The fraction of tangential speed retained when friction applies.
f32 g_fConst1p05
 The fixed part of collision restitution.

Detailed Description

The physics of the vehicles: the forces on their bodies and wheels, the grip of the tyres, the suspension, and the collisions with the track and with each other.

A collision with the track works in the frame of the box of the body scaled to a unit cube: the triangles of the track in the cache are moved into it, and those that cross the cube are kept in a list for the steps of the frame.

Macro Definition Documentation

◆ GRIP_WEATHERS

#define GRIP_WEATHERS   3

The weathers the grip of a surface differs in: dry, rain and snow.

◆ TRACK_SURFACES

#define TRACK_SURFACES   8

The surfaces of the track.

◆ COLLISION_TRIANGLE_NODES

#define COLLISION_TRIANGLE_NODES   200

The nodes of the list.

◆ g_fCollisionContactW

#define g_fCollisionContactW   (g_vCollisionContact.axis[3])

The word after g_vCollisionContact, which ComputeCollisionPenetration() scales.

Ghidra address:
USA: 0x8037eab4
Ghidra address:
Asia: 0x8037E564
Ghidra address:
EUR: 0x80380fb4
Ghidra address:
JPN: 0x8037fc24

Typedef Documentation

◆ CollisionTriangleNode

typedef struct CollisionTriangleNode CollisionTriangleNode

A node of the list of the triangles that cross the box of a body.

◆ CollisionContactVector

typedef union CollisionContactVector CollisionContactVector

A contact plane with a vector view and its original four-component array view.

Function Documentation

◆ ResetCollisionCaches()

void ResetCollisionCaches ( void )

Empty the cache of the triangles and the list of the triangles that cross the box.

Ghidra address:
BRD3D: 0x1006ae20
Ghidra address:
BRGlide: 0x10063dd0
Ghidra address:
USA: 0x80259350
Ghidra address:
Asia: 0x80258EA0
Ghidra address:
EUR: 0x8025a920
Ghidra address:
JPN: 0x8025a2b0

◆ SumBodyForces()

void SumBodyForces ( RigidBody * body)

Add the forces of the list of a body to its sums of force and torque.

Parameters
bodyThe body whose forces are summed.
Ghidra address:
USA: 0x802594bc
Ghidra address:
Asia: 0x8025900C
Ghidra address:
EUR: 0x8025aa8c
Ghidra address:
JPN: 0x8025a41c
Ghidra address:
BRD3D: 0x1006aeb0
Ghidra address:
BRGlide: 0x10063e60

◆ SumWheelForces()

void SumWheelForces ( RigidBody * body,
RigidBody * wheel )

Add the forces of a wheel, in the frame of the body, to the force of the wheel, and the turn of their part along the ground to the torque of the body while the wheel touches the ground.

Parameters
bodyThe body of the vehicle.
wheelThe wheel whose forces are summed.
Ghidra address:
USA: 0x80259634
Ghidra address:
Asia: 0x80259184
Ghidra address:
EUR: 0x8025ac04
Ghidra address:
JPN: 0x8025a594
Ghidra address:
BRD3D: 0x1006aff0
Ghidra address:
BRGlide: 0x10063fa0

◆ ComputeVehicleAccelerations()

void ComputeVehicleAccelerations ( RigidBody * body)

Turn the sums of the force and torque of the body of a vehicle, and the forces of its wheels, into its accelerations, left in the sums.

Parameters
bodyThe body of the vehicle.
Ghidra address:
USA: 0x8025980c
Ghidra address:
Asia: 0x8025935C
Ghidra address:
EUR: 0x8025addc
Ghidra address:
JPN: 0x8025a76c
Ghidra address:
BRD3D: 0x1006b170
Ghidra address:
BRGlide: 0x10064120

◆ ComputeVehicleForces()

void ComputeVehicleForces ( RigidBody * body)

Sum the forces of the body of a vehicle and of its wheels, and turn them into its accelerations.

Parameters
bodyThe body of the vehicle.
Ghidra address:
USA: 0x8025993c
Ghidra address:
Asia: 0x8025948C
Ghidra address:
EUR: 0x8025af0c
Ghidra address:
JPN: 0x8025a89c
Ghidra address:
BRD3D: 0x1006b260
Ghidra address:
BRGlide: 0x10064210

◆ ComputeWheelLocalVelocity()

void ComputeWheelLocalVelocity ( Vec3f * out,
RigidBody * body,
RigidBody * wheel )

The velocity of the point of a body over a wheel at the height of the body, in the frame of the body.

Parameters
outReceives the velocity, in the frame of the body.
bodyThe body of the vehicle.
wheelThe wheel the point lies over.
Ghidra address:
USA: 0x80259a18
Ghidra address:
Asia: 0x80259568
Ghidra address:
EUR: 0x8025afe8
Ghidra address:
JPN: 0x8025a978
Ghidra address:
BRD3D: 0x1006b340
Ghidra address:
BRGlide: 0x100642f0

◆ GetWheelWorldVelocity()

void GetWheelWorldVelocity ( Vec3f * out,
RigidBody * body,
RigidBody * wheel )

The velocity of the point of a body at a wheel.

Parameters
outReceives the velocity, in the world.
bodyThe body of the vehicle.
wheelThe wheel at whose position the velocity is taken.
Ghidra address:
USA: 0x80259b1c
Ghidra address:
Asia: 0x8025966C
Ghidra address:
EUR: 0x8025b0ec
Ghidra address:
JPN: 0x8025aa7c
Ghidra address:
BRD3D: 0x1006b430
Ghidra address:
BRGlide: 0x100643e0

◆ GetBodyPointVelocity()

void GetBodyPointVelocity ( Vec3f * out,
RigidBody * body,
Vec3f * point )

The velocity of a point of a body, given in its frame.

Parameters
outReceives the velocity, in the world.
bodyThe body.
pointThe point, in the frame of the body.
Ghidra address:
USA: 0x80259c18
Ghidra address:
Asia: 0x80259768
Ghidra address:
EUR: 0x8025b1e8
Ghidra address:
JPN: 0x8025ab78
Ghidra address:
BRD3D: 0x1006b510
Ghidra address:
BRGlide: 0x100644c0

◆ ApplySideGrip()

void ApplySideGrip ( RigidBody * body,
f32 dt,
f32 * rearLoad,
f32 * frontLoad,
u8 * rearSliding,
u8 * frontSliding )

Cancel the sideways slip of the rear and the front of the body of a vehicle as far as the grip of the tyres allows on their surfaces, and lean the body as it skids.

Parameters
bodyThe body of the vehicle.
dtThe time of the step.
rearLoadThe load on the rear tyres, to which DriveWheel() adds.
frontLoadThe load on the front tyres, to which DriveWheel() adds.
rearSlidingWhether the rear tyres slid, updated for the next step.
frontSlidingWhether the front tyres slid, updated for the next step.
Ghidra address:
USA: 0x80259d14
Ghidra address:
Asia: 0x80259864
Ghidra address:
EUR: 0x8025b2e4
Ghidra address:
JPN: 0x8025ac74
Ghidra address:
BRD3D: 0x1006b5f0
Ghidra address:
BRGlide: 0x100645a0

◆ DriveWheel()

void DriveWheel ( RigidBody * body,
RigidBody * wheel,
f32 * load,
u8 * sliding,
f32 dt )

Drive a wheel on the ground, pushing the body along the way the wheel rolls by its drive, as far as the weight on it lets it, and spin and turn the wheel.

Parameters
bodyThe body of the vehicle.
wheelThe wheel to drive.
loadThe load of its tyres, to which half the push is added.
slidingWhether its tyres slid, selecting sliding traction.
dtThe time of the step.
Ghidra address:
USA: 0x8025ac9c
Ghidra address:
Asia: 0x8025A7EC
Ghidra address:
EUR: 0x8025c280
Ghidra address:
JPN: 0x8025bc10
Ghidra address:
BRD3D: 0x1006c1f0
Ghidra address:
BRGlide: 0x100651a0

◆ IsPointInTrackTriangle()

s16 IsPointInTrackTriangle ( TrackTriangle * triangle,
Vec3f * point )

Whether a point lies within a triangle of the track, seen along the main axis of its normal.

Parameters
triangleThe triangle.
pointThe point, on the plane of the triangle.
Returns
1 when the point lies within the triangle, otherwise 0.
Ghidra address:
USA: 0x8025b3b0
Ghidra address:
Asia: 0x8025AF00
Ghidra address:
EUR: 0x8025c994
Ghidra address:
JPN: 0x8025c324
Ghidra address:
BRD3D: 0x1006c740
Ghidra address:
BRGlide: 0x100656f0

◆ PlaneDistance()

f32 PlaneDistance ( Vec3f * normal,
f32 offset,
Vec3f * point )

The distance of a point from a plane.

Parameters
normalThe unit normal of the plane.
offsetThe constant term of the equation of the plane.
pointThe point.
Returns
The signed distance, positive on the side the normal points to.
Ghidra address:
USA: 0x8025b704
Ghidra address:
Asia: 0x8025B254
Ghidra address:
EUR: 0x8025cce8
Ghidra address:
JPN: 0x8025c678
Ghidra address:
BRD3D: 0x1006c9a0
Ghidra address:
BRGlide: 0x10065950

◆ BounceOffPlane()

s32 BounceOffPlane ( RigidBody * body,
Vec3f * normal,
s32 damp,
s32 spin )

Stop the next step of a body moving into a plane, with a little bounce, record a hard hit, and damp its spin about the plane.

Parameters
bodyThe body whose next step bounces.
normalThe unit normal of the plane, pointing out of it.
dampWhether the velocity is damped as well.
spinWhether the spin is damped.
Returns
Whether the body moved into the plane.
Ghidra address:
USA: 0x8025b73c
Ghidra address:
Asia: 0x8025B28C
Ghidra address:
EUR: 0x8025cd20
Ghidra address:
JPN: 0x8025c6b0
Ghidra address:
BRD3D: 0x1006c9d0
Ghidra address:
BRGlide: 0x10065980

◆ UnusedCollisionResponseStub()

s32 UnusedCollisionResponseStub ( void * body,
void * normal,
void * damp )

An empty collision response.

Parameters
bodyA body this routine ignores.
normalA normal this routine ignores.
dampA flag this routine ignores.
Returns
Always 1.
Ghidra address:
USA: 0x8025bba4
Ghidra address:
Asia: 0x8025B6F4
Ghidra address:
EUR: 0x8025d188
Ghidra address:
JPN: 0x8025cb18

◆ ApplyCollisionImpulse()

s32 ApplyCollisionImpulse ( RigidBody * body,
Vec3f * point,
Vec3f * normal,
s32 friction,
f32 restitution )

Give the next step of a body the impulse at a point of it, in its frame, that stops the point moving into a surface, record a hard hit, and retain a part of the slide along the surface.

Parameters
bodyThe body whose next step receives the impulse.
pointThe point of contact, in the frame of the body.
normalThe unit normal of the surface.
frictionWhether a fifth of the slide is retained, rather than none.
restitutionHow much the point bounces, more than the 1.05 it always does.
Returns
Whether the point moved into the surface.
Ghidra address:
USA: 0x8025bbb8
Ghidra address:
Asia: 0x8025B708
Ghidra address:
EUR: 0x8025d19c
Ghidra address:
JPN: 0x8025cb2c
Ghidra address:
BRD3D: 0x1006ccd0
Ghidra address:
BRGlide: 0x10065c80

◆ PushCollisionTriangle()

void PushCollisionTriangle ( TrackTriangle * triangle)

Add a triangle to the list of those that cross the box.

Parameters
triangleThe triangle to add.
Ghidra address:
USA: 0x8025c24c
Ghidra address:
Asia: 0x8025BD9C
Ghidra address:
EUR: 0x8025d830
Ghidra address:
JPN: 0x8025d1c0
Ghidra address:
BRD3D: 0x1006d280
Ghidra address:
BRGlide: 0x10066230

◆ PrintCollisionTriangleCount()

void PrintCollisionTriangleCount ( void )

Print the length of the list on the debug output.

Ghidra address:
USA: 0x8025c27c
Ghidra address:
Asia: 0x8025BDCC
Ghidra address:
EUR: 0x8025d860
Ghidra address:
JPN: 0x8025d1f0

◆ ClassifyTriangleInUnitCube()

s32 ClassifyTriangleInUnitCube ( Vec3f triangle[3])

Sort out a triangle against the unit cube by its corners and its edges.

Parameters
triangleThe corners of the triangle in the frame of the unit cube.
Returns
1 when a corner is inside the cube, 0 when the triangle is wholly outside it, and -1 when it is not yet known.
Ghidra address:
USA: 0x8025c2c8
Ghidra address:
Asia: 0x8025BE18
Ghidra address:
EUR: 0x8025d8ac
Ghidra address:
JPN: 0x8025d23c
Ghidra address:
BRD3D: 0x1006d2b0
Ghidra address:
BRGlide: 0x10066260

◆ CountTriangleWinding()

s32 CountTriangleWinding ( Vec3f triangle[3],
Vec3f * normal,
Vec3f * point )

How many times a triangle winds about a point of its plane, seen along the main axis of its normal.

Parameters
triangleThe corners of the triangle.
normalThe normal of the triangle.
pointThe point, on the plane of the triangle.
Returns
The winding number, 0 for a point outside the triangle.
Ghidra address:
USA: 0x8025c8dc
Ghidra address:
Asia: 0x8025C42C
Ghidra address:
EUR: 0x8025dec0
Ghidra address:
JPN: 0x8025d850
Ghidra address:
BRD3D: 0x1006d660
Ghidra address:
BRGlide: 0x10066610

◆ DoesSegmentCrossUnitCube()

s32 DoesSegmentCrossUnitCube ( Vec3f * start,
Vec3f * end )

Whether a segment passes through the unit cube.

Parameters
startOne end of the segment.
endThe other end of the segment.
Returns
1 when the segment passes through the cube, otherwise 0.
Ghidra address:
USA: 0x8025cbf8
Ghidra address:
Asia: 0x8025C748
Ghidra address:
EUR: 0x8025e1dc
Ghidra address:
JPN: 0x8025db6c
Ghidra address:
BRD3D: 0x1006d850
Ghidra address:
BRGlide: 0x10066800

◆ DoesTriangleCrossUnitCube()

s32 DoesTriangleCrossUnitCube ( Vec3f triangle[3],
Vec3f * normal )

Whether an edge of a triangle, or a diagonal of the unit cube, crosses the other.

Parameters
triangleThe corners of the triangle in the frame of the unit cube.
normalThe normal of the triangle.
Returns
Nonzero when they cross, otherwise 0.
Ghidra address:
USA: 0x8025ce28
Ghidra address:
Asia: 0x8025C978
Ghidra address:
EUR: 0x8025e40c
Ghidra address:
JPN: 0x8025dd9c
Ghidra address:
BRD3D: 0x1006d9a0
Ghidra address:
BRGlide: 0x10066950

◆ IsTriangleInUnitCube()

s32 IsTriangleInUnitCube ( Vec3f triangle[3],
Vec3f * normal )

Whether a triangle crosses the unit cube.

Parameters
triangleThe corners of the triangle in the frame of the unit cube.
normalThe normal of the triangle.
Returns
Nonzero when the triangle crosses the cube, otherwise 0.
Ghidra address:
USA: 0x8025d018
Ghidra address:
Asia: 0x8025CB68
Ghidra address:
EUR: 0x8025e5fc
Ghidra address:
JPN: 0x8025df8c
Ghidra address:
BRD3D: 0x1006daf0
Ghidra address:
BRGlide: 0x10066aa0

◆ CollectTrianglesInBox()

s32 CollectTrianglesInBox ( RigidBody * body,
f32 box[4][4] )

List the triangles of the cache under a body that cross its box.

Parameters
bodyThe body whose position selects the cell of the cache.
boxThe matrix that takes the track into the unit cube of the box.
Returns
The triangles listed.
Ghidra address:
USA: 0x8025d060
Ghidra address:
Asia: 0x8025CBB0
Ghidra address:
EUR: 0x8025e644
Ghidra address:
JPN: 0x8025dfd4
Ghidra address:
BRD3D: 0x1006db20
Ghidra address:
BRGlide: 0x10066ad0

◆ UnusedTrackCollisionStub()

s32 UnusedTrackCollisionStub ( void * body)

An empty collision of a body with the track.

Parameters
bodyA body this routine ignores.
Returns
Always 0.
Ghidra address:
USA: 0x8025d35c
Ghidra address:
Asia: 0x8025CEAC
Ghidra address:
EUR: 0x8025e940
Ghidra address:
JPN: 0x8025e2d0

◆ TipBalancedVehicle()

s32 TipBalancedVehicle ( RigidBody * body)

Roll a vehicle that stands still balanced on one or two wheels off its balance, printing what it finds on the debug output.

Parameters
bodyThe body of the vehicle.
Returns
Whether it was rolled.
Ghidra address:
USA: 0x8025d368
Ghidra address:
Asia: 0x8025CEB8
Ghidra address:
BRD3D: 0x1006ddc0
Ghidra address:
BRGlide: 0x10066d70
Ghidra address:
EUR: 0x8025e94c
Ghidra address:
JPN: 0x8025e2dc

◆ ComputeCollisionPenetration()

void ComputeCollisionPenetration ( RigidBody * body,
Vec3f * normal,
f32 offset,
Vec3f * contact,
Vec3f triangle[3] )

Find how far the box of a body is into a triangle.

Parameters
bodyThe body whose box scales the contact.
normalThe unit normal of the triangle in the unit cube.
offsetThe distance of the plane of the triangle from the middle of the cube.
contactThe corner or the face of the box in the unit cube.
triangleThe corners of the triangle in the unit cube.
Ghidra address:
USA: 0x8025dcb8
Ghidra address:
Asia: 0x8025D808
Ghidra address:
EUR: 0x8025f29c
Ghidra address:
JPN: 0x8025ec2c
Ghidra address:
BRD3D: 0x1006e4c0
Ghidra address:
BRGlide: 0x10067470

◆ CollideBodyWithTriangles()

s32 CollideBodyWithTriangles ( RigidBody * body,
f32 box[4][4] )

Collide the next step of a body with the listed triangles that cross its box, and move it back out of those it hit.

Parameters
bodyThe body to collide.
boxThe matrix that takes the track into the unit cube of the box.
Returns
Whether it hit one.
Ghidra address:
USA: 0x8025dfcc
Ghidra address:
Asia: 0x8025DB1C
Ghidra address:
EUR: 0x8025f5b0
Ghidra address:
JPN: 0x8025ef40
Ghidra address:
BRD3D: 0x1006e760
Ghidra address:
BRGlide: 0x10067710

◆ StepVehicleCollisions()

void StepVehicleCollisions ( RigidBody * body)

Step the vehicle body through a frame, collide it, and count its upside-down frames.

Parameters
bodyThe body of the vehicle.
Ghidra address:
USA: 0x8025e55c
Ghidra address:
Asia: 0x8025E0AC
Ghidra address:
EUR: 0x8025fa38
Ghidra address:
JPN: 0x8025f4e8

◆ ComputeDragForce()

void ComputeDragForce ( RigidBody * body,
RigidBodyForce * force )

Set a force to the drag on the body of a vehicle, which grows on the surface that slows it.

Parameters
bodyThe body of the vehicle.
forceThe force to set.
Ghidra address:
USA: 0x8025e820
Ghidra address:
Asia: 0x8025E370
Ghidra address:
EUR: 0x8025fcfc
Ghidra address:
JPN: 0x8025f7ac
Ghidra address:
BRD3D: 0x1006ef80
Ghidra address:
BRGlide: 0x10067f30

◆ CastWheelRay()

f32 CastWheelRay ( RigidBody * body,
RigidBody * wheel )

Find the ground below a wheel in the cache of the triangles.

Parameters
bodyThe body of the vehicle.
wheelThe wheel, whose ground, surface, and plane are set to those found.
Returns
How far below the body the ground is, or 100 when there is none.
Ghidra address:
USA: 0x8025e96c
Ghidra address:
Asia: 0x8025E4BC
Ghidra address:
EUR: 0x8025fe48
Ghidra address:
JPN: 0x8025f8f8
Ghidra address:
BRD3D: 0x1006f0c0
Ghidra address:
BRGlide: 0x10068070

◆ UpdateWheelHeights()

void UpdateWheelHeights ( RigidBody * body)

Find the ground below each wheel of a vehicle, and hang each wheel to it, no more than 0.4 down.

Parameters
bodyThe body of the vehicle.
Ghidra address:
USA: 0x8025ec7c
Ghidra address:
Asia: 0x8025E7CC
Ghidra address:
EUR: 0x80260158
Ghidra address:
JPN: 0x8025fc08
Ghidra address:
BRD3D: 0x1006f4a0
Ghidra address:
BRGlide: 0x10068450

◆ ComputeSpringForces()

void ComputeSpringForces ( RigidBody * body)

Set the springs of the wheels of a vehicle, and count the frames each wheel touches the ground.

Parameters
bodyThe body of the vehicle.
Ghidra address:
USA: 0x8025edbc
Ghidra address:
Asia: 0x8025E90C
Ghidra address:
EUR: 0x80260298
Ghidra address:
JPN: 0x8025fd48
Ghidra address:
BRD3D: 0x1006f540
Ghidra address:
BRGlide: 0x100684f0

◆ ComputeDampingForces()

void ComputeDampingForces ( RigidBody * body)

Set the dampers of the wheels of a vehicle on the ground.

Parameters
bodyThe body of the vehicle.
Ghidra address:
USA: 0x8025ef70
Ghidra address:
Asia: 0x8025EAC0
Ghidra address:
EUR: 0x8026044c
Ghidra address:
JPN: 0x8025fefc
Ghidra address:
BRD3D: 0x1006f650
Ghidra address:
BRGlide: 0x10068600

◆ TestObbIntersection()

s32 TestObbIntersection ( f32 rotation[3][3],
Vec3f * offset,
Vec3f * halfA,
Vec3f * halfB )

Whether two boxes overlap, by the separating axes of their faces and of the products of their edges.

Parameters
rotationThe rotation of the second box in the frame of the first.
offsetThe second box from the first, in the frame of the first.
halfAThe half extents of the first box.
halfBThe half extents of the second box.
Returns
1 when the boxes overlap, otherwise 0.
Ghidra address:
USA: 0x8025f4f8
Ghidra address:
Asia: 0x8025F048
Ghidra address:
EUR: 0x802609d4
Ghidra address:
JPN: 0x80260484
Ghidra address:
BRD3D: 0x1006f950
Ghidra address:
BRGlide: 0x10068900

◆ CollideVehicles()

void CollideVehicles ( void )

Collide each pair of the vehicles of the race that are near, sharing their speed along the line between them and pushing them apart.

It stops at the first pair whose boxes do not meet.

Ghidra address:
USA: 0x8025fde4
Ghidra address:
Asia: 0x8025F934
Ghidra address:
BRD3D: 0x1006ffd0
Ghidra address:
BRGlide: 0x10068f80
Ghidra address:
EUR: 0x802612c0
Ghidra address:
JPN: 0x80260d70

Variable Documentation

◆ g_aCollisionTriangleNodes

CollisionTriangleNode g_aCollisionTriangleNodes[COLLISION_TRIANGLE_NODES]
extern

The nodes available for the triangles crossing the box of a body.

Ghidra address:
BRD3D: 0x11754e50
Ghidra address:
BRGlide: 0x117781b0
Ghidra address:
USA: 0x80379940
Ghidra address:
Asia: 0x803793F0
Ghidra address:
EUR: 0x8037be40
Ghidra address:
JPN: 0x8037aab0

◆ g_pCollisionTriangleList

CollisionTriangleNode* g_pCollisionTriangleList
extern

The list, the latest first.

Ghidra address:
BRD3D: 0x11754e38
Ghidra address:
BRGlide: 0x11778198
Ghidra address:
USA: 0x802a4a20
Ghidra address:
Asia: 0x802A4570
Ghidra address:
EUR: 0x802a71e0
Ghidra address:
JPN: 0x802a6c80

◆ g_pNextCollisionTriangleNode

CollisionTriangleNode* g_pNextCollisionTriangleNode
extern

The next free node.

Ghidra address:
BRD3D: 0x117554e4
Ghidra address:
BRGlide: 0x11778844
Ghidra address:
USA: 0x802a4a24
Ghidra address:
Asia: 0x802A4574
Ghidra address:
EUR: 0x802a71e4
Ghidra address:
JPN: 0x802a6c84

◆ g_dwCollisionContactType

s32 g_dwCollisionContactType
extern

How the last collision with a triangle is resolved: 1 against its plane alone, 2 at the face of the box nearest the triangle, otherwise at the corner of the box.

Ghidra address:
USA: 0x802a4a28
Ghidra address:
Asia: 0x802A4578
Ghidra address:
EUR: 0x802a71e8
Ghidra address:
JPN: 0x802a6c88

◆ g_pCollisionTriangle

TrackTriangle* g_pCollisionTriangle
extern

The triangle of the last collision.

Ghidra address:
USA: 0x802a4a2c
Ghidra address:
Asia: 0x802A457C
Ghidra address:
EUR: 0x802a71ec
Ghidra address:
JPN: 0x802a6c8c
Ghidra address:
BRD3D: 0x11754e3c
Ghidra address:
BRGlide: 0x1177819c

◆ g_bTrackCollisionFrameToggle

s32 g_bTrackCollisionFrameToggle
extern

Whether the triangles of the cache are collected from the last.

Ghidra address:
USA: 0x802a4a30
Ghidra address:
Asia: 0x802A4580
Ghidra address:
EUR: 0x802a71f0
Ghidra address:
JPN: 0x802a6c90
Ghidra address:
BRD3D: 0x117554e8
Ghidra address:
BRGlide: 0x11778848

◆ g_afSurfaceGrip

f32 g_afSurfaceGrip[GRIP_WEATHERS][TRACK_SURFACES]
extern

The grip of the tyres on each surface in each weather, the load below which they hold, and the load above which they hold no less.

Ghidra address:
USA: 0x802a4a38
Ghidra address:
Asia: 0x802A4588
Ghidra address:
EUR: 0x802a71f8
Ghidra address:
JPN: 0x802a6c98

◆ g_afSurfaceMaxLoad

f32 g_afSurfaceMaxLoad[GRIP_WEATHERS][TRACK_SURFACES]
extern

The tyre load at which the surface grip stops increasing, by weather and surface.

Ghidra address:
USA: 0x802a4a98
Ghidra address:
Asia: 0x802A45E8
Ghidra address:
EUR: 0x802a7258
Ghidra address:
JPN: 0x802a6cf8

◆ g_afSurfaceSlipLoad

f32 g_afSurfaceSlipLoad[GRIP_WEATHERS][TRACK_SURFACES]
extern

The minimum tyre load used when calculating sliding grip, by weather and surface.

Ghidra address:
USA: 0x802a4af8
Ghidra address:
Asia: 0x802A4648
Ghidra address:
EUR: 0x802a72b8
Ghidra address:
JPN: 0x802a6d58
Ghidra address:
BRD3D: 0x100b5970
Ghidra address:
BRGlide: 0x100b5178

◆ g_vecUnitX

Vec3f g_vecUnitX
extern

The axes.

Ghidra address:
USA: 0x802a4b58
Ghidra address:
Asia: 0x802A46A8

◆ g_vecUnitY

Vec3f g_vecUnitY
extern

The unit vector along the positive Y axis.

Ghidra address:
USA: 0x802a4b64
Ghidra address:
Asia: 0x802A46B4
Ghidra address:
EUR: 0x802a7324
Ghidra address:
JPN: 0x802a6dc4

◆ g_vecUnitZ

Vec3f g_vecUnitZ
extern

The unit vector along the positive Z axis.

Ghidra address:
USA: 0x802a4b70
Ghidra address:
Asia: 0x802A46C0
Ghidra address:
EUR: 0x802a7330
Ghidra address:
JPN: 0x802a6dd0

◆ g_vecNegUnitZ

Vec3f g_vecNegUnitZ
extern

The unit vector along the negative Z axis.

Ghidra address:
USA: 0x802a4b94
Ghidra address:
Asia: 0x802A46E4
Ghidra address:
EUR: 0x802a7354
Ghidra address:
JPN: 0x802a6df4

◆ g_vVehicleObbHalfExtents

Vec3f g_vVehicleObbHalfExtents
extern

The half extents of the box two vehicles collide by.

Ghidra address:
USA: 0x802a4ba0
Ghidra address:
Asia: 0x802A46F0
Ghidra address:
EUR: 0x802a7360
Ghidra address:
JPN: 0x802a6e00

◆ g_vCollisionContact

CollisionContactVector g_vCollisionContact
extern

Where the last collision with the track touched the body, in its frame.

Ghidra address:
USA: 0x8037eaa8
Ghidra address:
Asia: 0x8037E558
Ghidra address:
EUR: 0x80380fa8
Ghidra address:
JPN: 0x8037fc18
Ghidra address:
BRD3D: 0x11755490
Ghidra address:
BRGlide: 0x117787f0

◆ g_vCollisionPenetration

Vec3f g_vCollisionPenetration
extern

How far the last collision put the body into the triangle.

Ghidra address:
USA: 0x8037eac8
Ghidra address:
Asia: 0x8037E578
Ghidra address:
EUR: 0x80380fc8
Ghidra address:
JPN: 0x8037fc38
Ghidra address:
BRD3D: 0x11754e40
Ghidra address:
BRGlide: 0x117781a0

◆ g_fConst0p0001

f32 g_fConst0p0001
extern

The restitution threshold for recording a hard collision.

Ghidra address:
USA: 0x802ab7f8
Ghidra address:
Asia: 0x802AB2B8
Ghidra address:
EUR: 0x802ad4f0
Ghidra address:
JPN: 0x802abf28

◆ g_fConst0p9_3

f32 g_fConst0p9_3
extern

The velocity scale after a hard collision.

Ghidra address:
USA: 0x802ab7fc
Ghidra address:
Asia: 0x802AB2BC
Ghidra address:
EUR: 0x802ad4f4
Ghidra address:
JPN: 0x802abf2c

◆ g_fConst0p2

f32 g_fConst0p2
extern

The fraction of tangential speed retained when friction applies.

Ghidra address:
USA: 0x802ab800
Ghidra address:
Asia: 0x802AB2C0
Ghidra address:
EUR: 0x802ad4f8
Ghidra address:
JPN: 0x802abf30

◆ g_fConst1p05

f32 g_fConst1p05
extern

The fixed part of collision restitution.

Ghidra address:
USA: 0x802ab804
Ghidra address:
Asia: 0x802AB2C4
Ghidra address:
EUR: 0x802ad4fc
Ghidra address:
JPN: 0x802abf34