Table of Contents

Class SolidBody

Namespace
Gravitas
Assembly
Gravitas.dll

Represents deterministic 3D rigid-body state owned by one world context.

public class SolidBody : IRecordable
Inheritance
SolidBody
Implements
IRecordable
Inherited Members

Constructors

SolidBody(IMatterAgent, LSCollider)

Creates a 3D body bound to a host agent and collider.

public SolidBody(IMatterAgent agent, LSCollider collider)

Parameters

agent IMatterAgent
collider LSCollider

Fields

CanSetVisualPosition

Enables publishing interpolated positions to PositionTransform.

public bool CanSetVisualPosition

Field Value

bool

CanSetVisualRotation

Enables publishing interpolated rotations to RotationTransform.

public bool CanSetVisualRotation

Field Value

bool

Debug

Stores the host-controlled body diagnostic flag.

public bool Debug

Field Value

bool

DefaultRotationSpeed

Controls visual rotation interpolation when the host agent is not interacting.

public Fixed64 DefaultRotationSpeed

Field Value

Fixed64

GroundDownDistanceOnAir

Automatic ground-probe distance used while airborne.

public Fixed64 GroundDownDistanceOnAir

Field Value

Fixed64

GroundOriginOffset

Vertical offset applied to the origin of automatic ground probes.

public Fixed64 GroundOriginOffset

Field Value

Fixed64

GroundedDistanceRay

Automatic ground-probe distance used while grounded.

public Fixed64 GroundedDistanceRay

Field Value

Fixed64

InteractionRotationSpeed

Controls visual rotation interpolation while the host agent is interacting.

public Fixed64 InteractionRotationSpeed

Field Value

Fixed64

LinearDragCoefficient

Represents a body's resistance to movement, akin to air resistance. Higher values slow down the body more quickly in absence of other forces. The effect is significant when bodies are expected to slow down or stop without sustained forces. It's not constrained between 0 and 1, depends on the object's shape and the flow conditions.

public Fixed64 LinearDragCoefficient

Field Value

Fixed64

Mass

Mass used by integration and collision response.

public Fixed64 Mass

Field Value

Fixed64

OnGrounded

Raised when the grounded state changes.

public Action<bool>? OnGrounded

Field Value

Action<bool>

OnMoved

Called after authoritative position or rotation changes have been committed during simulation.

public Action? OnMoved

Field Value

Action

StepOffset

Minimum downward snap distance used to preserve grounding across steps.

public Fixed64 StepOffset

Field Value

Fixed64

Properties

Active

Gets whether the body is initialized and registered.

public bool Active { get; }

Property Value

bool

Agent

Gets the host agent that owns this body.

public IMatterAgent Agent { get; }

Property Value

IMatterAgent

AngularAcceleration

Gets the angular acceleration measured during the latest integration step.

public Vector3d AngularAcceleration { get; }

Property Value

Vector3d

AngularSpeed

Gets the magnitude of AngularVelocity.

public Fixed64 AngularSpeed { get; }

Property Value

Fixed64

AngularVelocity

Gets the authoritative world-space angular velocity.

public Vector3d AngularVelocity { get; }

Property Value

Vector3d

CanRotate

Gets whether solver-side response may rotate this body.

public bool CanRotate { get; }

Property Value

bool

CanTranslate

Gets whether solver-side response may translate this body.

public bool CanTranslate { get; }

Property Value

bool

Collider

Gets the runtime collider attached to this body.

public LSCollider Collider { get; }

Property Value

LSCollider

Context

Gets the world context supplied by the host agent.

public GravitasWorldContext Context { get; }

Property Value

GravitasWorldContext

ContinuousCollisionMode

Selects the deterministic tunneling guard used when this body commits frame movement. Inherited values resolve through the cached top-parent body before falling back to context settings.

public ContinuousCollisionMode ContinuousCollisionMode { get; set; }

Property Value

ContinuousCollisionMode

Exceptions

ArgumentOutOfRangeException

The value is not a declared continuous-collision mode.

DynamicId

Gets the ephemeral simulated-body slot, or -1 for a static or unregistered body.

public int DynamicId { get; }

Property Value

int

EffectiveInverseInertiaTensor

Gets the inverse inertia tensor that should be used by collision response. Bodies that cannot rotate expose a zero tensor even when raw inertia is available.

public Fixed3x3 EffectiveInverseInertiaTensor { get; }

Property Value

Fixed3x3

EffectiveInverseMass

Gets the inverse mass that should be used by collision response. Translation-frozen, static, and kinematic bodies expose their raw mass but contribute zero constrained inverse mass.

public Fixed64 EffectiveInverseMass { get; }

Property Value

Fixed64

Forward

Gets the body's world-space forward direction.

public Vector3d Forward { get; }

Property Value

Vector3d

FreezeAxes

Gets or sets the 3D translational and rotational degrees of freedom frozen for solver response, integration, and CCD.

public BodyFreezeAxes3D FreezeAxes { get; set; }

Property Value

BodyFreezeAxes3D

GravityScale

Multiplies context environment gravity for this body. Zero disables gravity-derived acceleration and grounded weight.

public Fixed64 GravityScale { get; set; }

Property Value

Fixed64

GroundNormal

Gets the world-space normal of the current supporting surface.

public Vector3d GroundNormal { get; }

Property Value

Vector3d

GroundProbeMode

Selects the deterministic query primitive used for ground checks.

public GroundProbeMode GroundProbeMode { get; set; }

Property Value

GroundProbeMode

GroundProbeRadius

Optional explicit radius for swept-sphere ground probes. A zero value derives the radius from the collider.

public Fixed64 GroundProbeRadius { get; set; }

Property Value

Fixed64

GroundingMode

Selects whether Gravitas probes for ground automatically or preserves host-supplied grounding state.

public GroundingMode GroundingMode { get; }

Property Value

GroundingMode

HasHitPoint

Gets whether the current ground point is representable.

public bool HasHitPoint { get; }

Property Value

bool

HeightPos

Gets the authoritative world-space Y coordinate.

public Fixed64 HeightPos { get; }

Property Value

Fixed64

HitPlatform

Gets the transform of the current supporting collider, if available.

public FixedTransform? HitPlatform { get; }

Property Value

FixedTransform

HitPoint

Gets the current materialized ground point.

public Vector3d HitPoint { get; }

Property Value

Vector3d

Exceptions

InvalidOperationException

No representable ground point is available.

InverseInertiaTensor

Gets the constrained world-space inverse inertia tensor.

public Fixed3x3 InverseInertiaTensor { get; }

Property Value

Fixed3x3

InverseMass

Gets the reciprocal mass, or zero when Mass is zero.

public Fixed64 InverseMass { get; }

Property Value

Fixed64

IsAtRest

Gets whether both linear and angular velocity are exactly zero.

public bool IsAtRest { get; }

Property Value

bool

IsDynamic

Gets whether the solver controls this body.

public bool IsDynamic { get; }

Property Value

bool

IsGrounded

Gets whether the body currently has valid ground support.

public bool IsGrounded { get; }

Property Value

bool

IsKinematic

Gets whether the host controls this body's pose.

public bool IsKinematic { get; }

Property Value

bool

IsPositionFullyFrozen

Gets whether all translation axes are frozen.

public bool IsPositionFullyFrozen { get; }

Property Value

bool

IsRotationFullyFrozen

Gets whether all rotation axes are frozen.

public bool IsRotationFullyFrozen { get; }

Property Value

bool

IsSleeping

Gets whether this dynamic body is currently excluded from solver work until a deterministic wake event occurs.

public bool IsSleeping { get; }

Property Value

bool

IsStatic

Gets whether this body is excluded from per-frame motion.

public bool IsStatic { get; }

Property Value

bool

LastContinuousCollisionToiIterationCount

Gets the number of continuous-collision impacts consumed by the most recent late simulation step.

public int LastContinuousCollisionToiIterationCount { get; }

Property Value

int

LastContinuousCollisionToiIterationLimitReached

Gets whether the most recent late simulation step reached the configured continuous-collision TOI iteration limit.

public bool LastContinuousCollisionToiIterationLimitReached { get; }

Property Value

bool

LastGroundedPosition

Gets the body position captured before its latest grounded movement.

public Vector3d LastGroundedPosition { get; }

Property Value

Vector3d

LastVisualPosition

Gets the previous position interpolation endpoint.

public Vector3d LastVisualPosition { get; }

Property Value

Vector3d

LastVisualRotation

Gets the previous rotation interpolation endpoint.

public FixedQuaternion LastVisualRotation { get; }

Property Value

FixedQuaternion

LinearAcceleration

Gets the linear acceleration measured during the latest integration step.

public Vector3d LinearAcceleration { get; }

Property Value

Vector3d

LinearSpeed

Gets the magnitude of LinearVelocity.

public Fixed64 LinearSpeed { get; }

Property Value

Fixed64

LinearVelocity

Gets the authoritative world-space linear velocity.

public Vector3d LinearVelocity { get; }

Property Value

Vector3d

LocalCenterOfMassOffset

Gets or sets the authoritative body-local center-of-mass offset used by response and inertia.

public Vector3d LocalCenterOfMassOffset { get; set; }

Property Value

Vector3d

MotionType

Gets this body's explicit solver-controlled, host-controlled, or static runtime role.

public BodyMotionType MotionType { get; }

Property Value

BodyMotionType

Position3d

Gets the authoritative world-space position.

public Vector3d Position3d { get; }

Property Value

Vector3d

PositionChangePending

Gets whether an authoritative position change awaits presentation.

public bool PositionChangePending { get; }

Property Value

bool

PositionTransform

Gets the host transform that receives authoritative or visual position updates.

public FixedTransform PositionTransform { get; }

Property Value

FixedTransform

Right

Gets the body's world-space right direction.

public Vector3d Right { get; }

Property Value

Vector3d

Rotation

Gets the authoritative world-space rotation.

public FixedQuaternion Rotation { get; }

Property Value

FixedQuaternion

RotationChangePending

Gets whether an authoritative rotation change awaits presentation.

public bool RotationChangePending { get; }

Property Value

bool

RotationTransform

Gets the host transform that receives authoritative or visual rotation updates.

public FixedTransform RotationTransform { get; }

Property Value

FixedTransform

SleepAngularSpeedThreshold

Angular speed at or below which the body can count toward sleeping.

public Fixed64 SleepAngularSpeedThreshold { get; set; }

Property Value

Fixed64

SleepEnabled

Enables deterministic sleep evaluation for this body.

public bool SleepEnabled { get; set; }

Property Value

bool

SleepFrameThreshold

Number of consecutive fixed frames below sleep thresholds required before the body sleeps.

public int SleepFrameThreshold { get; set; }

Property Value

int

SleepLinearSpeedThreshold

Linear speed at or below which the body can count toward sleeping.

public Fixed64 SleepLinearSpeedThreshold { get; set; }

Property Value

Fixed64

Up

Gets the body's world-space up direction.

public Vector3d Up { get; }

Property Value

Vector3d

VisualPosition

Gets the current position interpolation endpoint.

public Vector3d VisualPosition { get; }

Property Value

Vector3d

VisualRotation

Gets the current rotation interpolation endpoint.

public FixedQuaternion VisualRotation { get; }

Property Value

FixedQuaternion

WasGrounded

Gets whether this body was grounded before the latest authoritative grounding refresh or manual grounding change.

public bool WasGrounded { get; }

Property Value

bool

World

Gets the GridForge world owned by Context.

public GridWorld World { get; }

Property Value

GridWorld

WorldCenterOfMass

Gets the authoritative world-space center of mass.

public Vector3d WorldCenterOfMass { get; }

Property Value

Vector3d

Exceptions

InvalidOperationException

The center lies outside the representable coordinate domain. Use TryGetWorldCenterOfMass(out Vector3d) when that is possible.

Methods

AddAngularImpulse(Vector3d)

Applies a world-space angular impulse immediately as an angular-velocity change. The impulse is expressed in mass-distance-squared-per-time units and does not apply a time-step factor.

public void AddAngularImpulse(Vector3d impulse)

Parameters

impulse Vector3d

The world-space angular impulse to apply.

AddForce(Vector3d)

Queues a force in mass-distance-per-time-squared units for integration during the next fixed step.

public void AddForce(Vector3d force)

Parameters

force Vector3d

The world-space force to apply.

AddLinearImpulse(Vector3d)

Applies a world-space linear impulse immediately as a velocity change. The impulse is expressed in mass-distance-per-time units and does not advance the fixed-step simulation or apply a time-step factor.

public void AddLinearImpulse(Vector3d impulse)

Parameters

impulse Vector3d

The world-space linear impulse to apply.

AddTorque(Vector3d)

Queues a torque in mass-distance-squared-per-time-squared units for integration during the next fixed step.

public void AddTorque(Vector3d torque)

Parameters

torque Vector3d

The world-space torque to apply.

CheckChangedValues()

Advances authoritative pose-change buffers used by presentation and culling.

public void CheckChangedValues()

CheckGround()

Immediately refreshes automatic grounded state.

public void CheckGround()

ClearManualGrounding()

Clears host-owned grounded state while leaving automatic probes disabled.

public void ClearManualGrounding()

Deactivate()

Releases the body's collider and context-local registration.

public void Deactivate()

GetLocalPoint(Vector3d)

Gets a body-local point from the authoritative body pose and committed collider scale.

public Vector3d GetLocalPoint(Vector3d point)

Parameters

point Vector3d

The world-space point.

Returns

Vector3d

The corresponding body-local point.

Exceptions

InvalidOperationException

The collider has no committed scale, its scale is singular, or the final body-local point is not representable.

GetWorldPoint(Vector3d)

Gets a world-space point from the authoritative body pose and committed collider scale.

public Vector3d GetWorldPoint(Vector3d point)

Parameters

point Vector3d

The body-local point.

Returns

Vector3d

The corresponding world-space point.

Exceptions

InvalidOperationException

The collider has no committed scale or the final world-space point is not representable.

Initialize(Vector3d, FixedQuaternion, BodyMotionType)

Initializes and registers the body at an authoritative world pose.

public void Initialize(Vector3d startPosition, FixedQuaternion startRotation, BodyMotionType motionType = BodyMotionType.Dynamic)

Parameters

startPosition Vector3d
startRotation FixedQuaternion
motionType BodyMotionType

LateSimulate()

Completes deferred body integration and post-step bookkeeping.

public void LateSimulate()

RecordData(IChronicler)

Records or restores deterministic body state through Chronicler.

public void RecordData(IChronicler chronicler)

Parameters

chronicler IChronicler

ResetCenterOfMassFromCollider()

Clears an explicit center-of-mass override and derives the offset from the bound collider again.

public void ResetCenterOfMassFromCollider()

ResetPosition(Vector3d, FixedQuaternion)

Resets the authoritative pose, motion, grounding, and presentation state.

public void ResetPosition(Vector3d position = default, FixedQuaternion rotation = default)

Parameters

position Vector3d
rotation FixedQuaternion

SetHeight(Fixed64)

Sets the authoritative world-space Y coordinate.

public void SetHeight(Fixed64 height)

Parameters

height Fixed64

SetManualGrounding(Vector3d, Vector3d, FixedTransform?)

Sets host-owned grounded state for manual grounding sources such as deterministic heightmaps.

public void SetManualGrounding(Vector3d hitPoint, Vector3d groundNormal, FixedTransform? hitPlatform = null)

Parameters

hitPoint Vector3d
groundNormal Vector3d
hitPlatform FixedTransform

SetMotionType(BodyMotionType)

Changes this registered body's runtime role between fixed-step transactions.

public void SetMotionType(BodyMotionType motionType)

Parameters

motionType BodyMotionType

Remarks

The transition preserves body, collider, pair, joint, and host identity, but clears incompatible motion, sleep, CCD, and solver-cache state before repartitioning. Freeze axes remain independent of the selected role.

Exceptions

ArgumentOutOfRangeException

motionType is undefined.

InvalidOperationException

The body is not currently registered, its context registration has been reset, or a simulation transaction or callback is active.

SetPosition(Vector3d)

Sets the authoritative world position and refreshes collider state.

public void SetPosition(Vector3d position)

Parameters

position Vector3d

SetRotation(FixedQuaternion)

Sets the authoritative world rotation and refreshes collider state.

public void SetRotation(FixedQuaternion quaternion)

Parameters

quaternion FixedQuaternion

SetVisualPosition(Vector3d)

Advances the position interpolation endpoints.

public void SetVisualPosition(Vector3d position)

Parameters

position Vector3d

SetVisualRotation(FixedQuaternion)

Advances the rotation interpolation endpoints.

public void SetVisualRotation(FixedQuaternion rotation)

Parameters

rotation FixedQuaternion

SkipGrounding(Fixed64)

Temporarily disables automatic ground probes and clears grounded state.

public void SkipGrounding(Fixed64 secs)

Parameters

secs Fixed64

Sleep()

Puts the body to sleep and keeps it partitioned for queries and deterministic wake propagation.

public void Sleep()

TryGetHitPoint(out Vector3d)

Attempts to get the current materialized ground point.

public bool TryGetHitPoint(out Vector3d hitPoint)

Parameters

hitPoint Vector3d

Returns

bool

TryGetLocalPoint(Vector3d, out Vector3d)

Attempts to get a body-local point from the authoritative body pose and committed collider scale.

public bool TryGetLocalPoint(Vector3d point, out Vector3d result)

Parameters

point Vector3d

The world-space point.

result Vector3d

The body-local point on success; otherwise zero.

Returns

bool

true when a committed nonsingular scale exists and the final point is representable.

TryGetWorldCenterOfMass(out Vector3d)

Attempts to materialize the authoritative world-space center of mass without saturation.

public bool TryGetWorldCenterOfMass(out Vector3d center)

Parameters

center Vector3d

Returns

bool

TryGetWorldPoint(Vector3d, out Vector3d)

Attempts to get a world-space point from the authoritative body pose and committed collider scale.

public bool TryGetWorldPoint(Vector3d point, out Vector3d result)

Parameters

point Vector3d

The body-local point.

result Vector3d

The world-space point on success; otherwise zero.

Returns

bool

true when a committed scale exists and the final point is representable.

UpdateRotation(FixedQuaternion, Fixed64)

Sets an authoritative target rotation and visual interpolation rate.

public void UpdateRotation(FixedQuaternion targetRotation, Fixed64 bufferInterpolation)

Parameters

targetRotation FixedQuaternion
bufferInterpolation Fixed64

UseAutomaticGrounding(bool)

Returns grounded-state ownership to Gravitas and optionally refreshes the automatic probe immediately.

public void UseAutomaticGrounding(bool checkGroundImmediately = true)

Parameters

checkGroundImmediately bool

UseManualGrounding(bool)

Gives the host ownership of grounded state and disables automatic ground probes.

public void UseManualGrounding(bool clearGrounding = true)

Parameters

clearGrounding bool

Wake()

Wakes a sleeping body because a deterministic simulation or host stimulus changed its state.

public void Wake()