1#ifndef COASTLINE_RIGIDBODY_H
2#define COASTLINE_RIGIDBODY_H
111 u8 unreconstructed203;
112 u8 unreconstructed204;
void Mtx3fMultiply(f32 out[3][3], f32 a[3][3], f32 b[3][3])
The product of two 3 by 3 matrices.
void ApplyRigidBodyImpulse(RigidBodyState *state, RigidBody *body, f32 dt)
Add the force and torque of a body over a time to the velocity and angular velocity of a state.
void MatrixToQuaternion(f32 m[4][4], Quaternion *q)
The unit quaternion of the rotation of a matrix, from the largest of its diagonal terms.
void QuaternionToMatrix(f32 out[4][4], RigidBodyState *state)
The 4 by 4 matrix of the orientation and position of a state.
void BuildSkewSymmetricMatrix(f32 out[3][3], Vec3f *v)
The matrix of the cross product with a vector.
void QuaternionNormalize(Quaternion *q)
Make a quaternion a unit quaternion.
void IntegrateRigidBodyState(RigidBodyState *out, RigidBodyState *in, f32 dt)
Advance a state by a time, keeping its velocities.
void StubPhysics2(void *data)
An empty hook QuaternionToMatrix() calls.
void MtxBuildScaledInverse(f32 m[4][4], f32 out[4][4], Vec3f *scale)
The inverse of a rigid transform whose axes are scaled.
void StubPhysics1(void *data)
An empty hook the inertia setup calls.
void Mtx4x4TransformPoint(Vec3f *out, f32 m[4][4], Vec3f *v)
A point times a matrix, with its translation.
void TransposeCopyMatrix3x3(f32 transpose[3][3], f32 copy[3][3], f32 m[4][4])
Copy the rotation of a matrix, and its transpose.
void QuaternionMultiply(Quaternion *out, Quaternion *a, Quaternion *b)
The product of two quaternions.
void ComputeDeltaQuaternion(RigidBodyState *state)
The rate of change of the orientation from the angular velocity: half of the product of the angular v...
void ApplySingleForceWithDebug(RigidBody *body, RigidBodyForce *force)
Add a force and its torque to the sums of a body, and print both on the debug output.
void ComputeRigidBodyAcceleration(RigidBody *body)
Turn the summed force and torque of a body into its accelerations.
@ RIGID_BODY_NO_ROTATION
Definition rigidbody.h:53
@ RIGID_BODY_BOX
Definition rigidbody.h:51
@ RIGID_BODY_BOX_1
Definition rigidbody.h:52
void SubtractMatrix3x3(f32 out[3][3], f32 a[3][3], f32 b[3][3])
The difference of two 3 by 3 matrices.
void InitRigidBody(RigidBody *body)
Reset a body, and set the inertia of a box from its size and mass.
void Mtx3x3MulVec3f(Vec3f *out, f32 m[4][4], Vec3f *v)
A vector times the rotation of a matrix, which turns a vector of the frame into the world.
void Mtx3fMulVec3f(Vec3f *out, f32 m[3][3], Vec3f *v)
A 3 by 3 matrix times a column vector.
void Vec3fNormalizeFast(Vec3f *v)
Make a vector a unit vector.
void ApplyAllForcesToBody(RigidBody *body)
Add each force of the list of a body to its sums of force and torque, printing each on the debug outp...
void SolveLinearSystem3x3(Vec3f *out, f32 a[3][3], Vec3f *b)
Solve a system of three linear equations by Cramer's rule.
void CopyMatrix4x4To3x3(f32 out[3][3], f32 m[4][4])
Copy the rotation of a matrix.
@ RIGID_BODY_FORCE_BODY
Definition rigidbody.h:38
@ RIGID_BODY_FORCE_WORLD
Definition rigidbody.h:37
void Transpose4x4Into3x3(f32 out[3][3], f32 m[4][4])
The transpose of the rotation of a matrix.
void Mtx4fInverseRotate(Vec3f *out, f32 m[4][4], Vec3f *v)
The dot products of the rotation rows of a matrix with a vector, which turns a vector of the world in...
void SetRigidBodyForce(RigidBodyForce *force, f32 x, f32 y, f32 z, f32 pointX, f32 pointY, f32 pointZ, s32 frame)
Set the vector, the point, and the frame of a force.
A rotation as a unit quaternion.
Definition rigidbody.h:19
f32 w
Definition rigidbody.h:20
f32 z
Definition rigidbody.h:23
f32 y
Definition rigidbody.h:22
f32 x
Definition rigidbody.h:21
A force on a rigid body, in a list.
Definition rigidbody.h:42
struct RigidBodyForce * next
Definition rigidbody.h:43
s32 frame
Definition rigidbody.h:44
Vec3f point
Definition rigidbody.h:46
Vec3f vector
Definition rigidbody.h:45
The motion of a rigid body at an instant.
Definition rigidbody.h:27
Vec3f angularVelocity
Definition rigidbody.h:31
Quaternion orientation
Definition rigidbody.h:30
Vec3f velocity
Definition rigidbody.h:29
Quaternion spin
Definition rigidbody.h:32
Vec3f position
Definition rigidbody.h:28
A rigid body: the body of a vehicle or of one of its wheels.
Definition rigidbody.h:60
f32 radius
Definition rigidbody.h:91
f32 mass
Definition rigidbody.h:68
struct TrackTriangle * ground
Definition rigidbody.h:77
f32 damping
Definition rigidbody.h:88
f32 orientation[4][4]
Definition rigidbody.h:73
u8 impactVolume
Definition rigidbody.h:105
u32 unreconstructed0
Definition rigidbody.h:61
u32 unreconstructed14
Definition rigidbody.h:64
u8 framesSinceImpact
Definition rigidbody.h:106
Vec3f size
Definition rigidbody.h:67
Vec3f groundNormal
Definition rigidbody.h:80
RigidBodyState state
Definition rigidbody.h:72
u8 landed
Definition rigidbody.h:115
Vec3f torque
Definition rigidbody.h:75
Vec3f force
Definition rigidbody.h:74
struct RigidBody * wheels[4]
Definition rigidbody.h:62
u8 unreconstructed202
Definition rigidbody.h:108
f32 suspension
Definition rigidbody.h:96
u8 framesSinceVehicleImpact
Definition rigidbody.h:107
f32 brake
Definition rigidbody.h:93
s32 uprightFrames
Definition rigidbody.h:100
Vec3f boxSize
Definition rigidbody.h:97
f32 drive
Definition rigidbody.h:92
f32 groundOffset
Definition rigidbody.h:83
f32 inverseInertia[3][3]
Definition rigidbody.h:70
RigidBodyForce * forces
Definition rigidbody.h:65
f32 springRate
Definition rigidbody.h:86
s32 kind
Definition rigidbody.h:66
Vec3f impactPoint
Definition rigidbody.h:99
u8 impactSpeed
Definition rigidbody.h:102
u8 vehicleImpactVolume
Definition rigidbody.h:104
s32 contactFrames
Definition rigidbody.h:84
f32 inertia[3][3]
Definition rigidbody.h:69
u8 skidding
Definition rigidbody.h:116
f32 rollAngle
Definition rigidbody.h:94
f32 spinRate
Definition rigidbody.h:90
f32 groundNormalComponents[3]
Definition rigidbody.h:81
f32 steerAngle
Definition rigidbody.h:89
u8 surface
Definition rigidbody.h:78
f32 boxCenterZ
Definition rigidbody.h:98
RigidBodyState stepStates[2]
Definition rigidbody.h:76
u8 tireType
Definition rigidbody.h:103
A triangle of the track with its plane.
Definition tricache.h:25
A point or direction in space.
Definition vecmath.h:17
The integer and floating-point types of the console, for headers shared with Windows.
unsigned int u32
Definition ultratypes.h:20
float f32
Definition ultratypes.h:38
int s32
Definition ultratypes.h:25
unsigned char u8
Definition ultratypes.h:18
The vector and matrix arithmetic of the game, its arctangent and power, the triangle and segment test...