Class WheelControllerState
Cached Rigidbody state for physics substepping. Allows wheel physics to run at higher frequency than Unity's native physics rate.
Namespace: NWH.WheelController3D
Assembly: NWH.WheelController.dll
Syntax
[Serializable]
public class WheelControllerState
Fields
| Edit this page View SourceangularVelocity
World-space angular velocity (rad/s).
Declaration
public Vector3 angularVelocity
Field Value
| Type | Description |
|---|---|
| Vector3 |
centerOfMass
Center of mass in body-local space (m).
Declaration
public Vector3 centerOfMass
Field Value
| Type | Description |
|---|---|
| Vector3 |
inertiaTensor
Diagonal inertia tensor in inertia space (kg*m^2).
Declaration
public Vector3 inertiaTensor
Field Value
| Type | Description |
|---|---|
| Vector3 |
inertiaTensorRotation
Rotation of the inertia tensor relative to the body.
Declaration
public Quaternion inertiaTensorRotation
Field Value
| Type | Description |
|---|---|
| Quaternion |
inverseInertiaTensor
Per-component reciprocal of inertiaTensor (0 where the tensor is near zero).
Declaration
public Vector3 inverseInertiaTensor
Field Value
| Type | Description |
|---|---|
| Vector3 |
inverseMass
Reciprocal of mass.
Declaration
public float inverseMass
Field Value
| Type | Description |
|---|---|
| float |
localToWorldMatrix
Body-to-world transform matrix (scale 1).
Declaration
public Matrix4x4 localToWorldMatrix
Field Value
| Type | Description |
|---|---|
| Matrix4x4 |
mass
Body mass (kg).
Declaration
public float mass
Field Value
| Type | Description |
|---|---|
| float |
position
World-space body position (m).
Declaration
public Vector3 position
Field Value
| Type | Description |
|---|---|
| Vector3 |
rotation
World-space body rotation.
Declaration
public Quaternion rotation
Field Value
| Type | Description |
|---|---|
| Quaternion |
velocity
World-space linear velocity (m/s).
Declaration
public Vector3 velocity
Field Value
| Type | Description |
|---|---|
| Vector3 |
worldCenterOfMass
Center of mass in world space (m).
Declaration
public Vector3 worldCenterOfMass
Field Value
| Type | Description |
|---|---|
| Vector3 |
worldToLocalMatrix
World-to-body transform matrix (inverse of localToWorldMatrix).
Declaration
public Matrix4x4 worldToLocalMatrix
Field Value
| Type | Description |
|---|---|
| Matrix4x4 |
Methods
| Edit this page View SourceApplyForce(Vector3, float)
Apply force at center of mass.
Declaration
public void ApplyForce(Vector3 force, float dt)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | force | |
| float | dt |
ApplyForceAtPosition(Vector3, Vector3, float)
Apply force at world position.
Declaration
public void ApplyForceAtPosition(Vector3 force, Vector3 worldPoint, float dt)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | force | |
| Vector3 | worldPoint | |
| float | dt |
ApplyTorque(Vector3, float)
Apply torque in world space.
Declaration
public void ApplyTorque(Vector3 torque, float dt)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | torque | |
| float | dt |
GetPointVelocity(Vector3)
Calculate point velocity at world position. Matches Rigidbody.GetPointVelocity behavior.
Declaration
public Vector3 GetPointVelocity(Vector3 worldPoint)
Parameters
| Type | Name | Description |
|---|---|---|
| Vector3 | worldPoint |
Returns
| Type | Description |
|---|---|
| Vector3 |
IntegrateTransform(float)
Integrate position and rotation forward by dt. Call after all forces for this substep have been applied.
Declaration
public void IntegrateTransform(float dt)
Parameters
| Type | Name | Description |
|---|---|---|
| float | dt |
ReadFromRigidbody(Rigidbody)
Read current state from a Rigidbody.
Declaration
public void ReadFromRigidbody(Rigidbody rb)
Parameters
| Type | Name | Description |
|---|---|---|
| Rigidbody | rb |