Table of Contents

Interface IPoseIntegratorCallbacks

Namespace
BepuPhysics
Assembly
BepuPhysics.dll

Defines a type that handles callbacks for body pose integration.

public interface IPoseIntegratorCallbacks

Properties

AllowSubstepsForUnconstrainedBodies

Gets whether the integrator should use only one step for unconstrained bodies when using a substepping solver. If true, unconstrained bodies use a single step of length equal to the dt provided to Timestep(float, IThreadDispatcher). If false, unconstrained bodies will be integrated with the same number of substeps as the constrained bodies in the solver.

bool AllowSubstepsForUnconstrainedBodies { get; }

Property Value

bool

AngularIntegrationMode

Gets how the pose integrator should handle angular velocity integration.

AngularIntegrationMode AngularIntegrationMode { get; }

Property Value

AngularIntegrationMode

IntegrateVelocityForKinematics

Gets whether the velocity integration callback should be called for kinematic bodies. If true, IntegrateVelocity(Vector<int>, Vector3Wide, QuaternionWide, BodyInertiaWide, Vector<int>, int, Vector<float>, ref BodyVelocityWide) will be called for bundles including kinematic bodies. If false, kinematic bodies will just continue using whatever velocity they have set. Most use cases should set this to false.

bool IntegrateVelocityForKinematics { get; }

Property Value

bool

Methods

Initialize(Simulation)

Performs any required initialization logic after the Simulation instance has been constructed.

void Initialize(Simulation simulation)

Parameters

simulation Simulation

Simulation that owns these callbacks.

IntegrateVelocity(Vector<int>, Vector3Wide, QuaternionWide, BodyInertiaWide, Vector<int>, int, Vector<float>, ref BodyVelocityWide)

Callback for a bundle of bodies being integrated.

void IntegrateVelocity(Vector<int> bodyIndices, Vector3Wide position, QuaternionWide orientation, BodyInertiaWide localInertia, Vector<int> integrationMask, int workerIndex, Vector<float> dt, ref BodyVelocityWide velocity)

Parameters

bodyIndices Vector<int>

Indices of the bodies being integrated in this bundle.

position Vector3Wide

Current body positions.

orientation QuaternionWide

Current body orientations.

localInertia BodyInertiaWide

Body's current local inertia.

integrationMask Vector<int>

Mask indicating which lanes are active in the bundle. Active lanes will contain 0xFFFFFFFF, inactive lanes will contain 0.

workerIndex int

Index of the worker thread processing this bundle.

dt Vector<float>

Durations to integrate the velocity over. Can vary over lanes.

velocity BodyVelocityWide

Velocity of bodies in the bundle. Any changes to lanes which are not active by the integrationMask will be discarded.

PrepareForIntegration(float)

Callback invoked ahead of dispatches that may call into IntegrateVelocity(Vector<int>, Vector3Wide, QuaternionWide, BodyInertiaWide, Vector<int>, int, Vector<float>, ref BodyVelocityWide). It may be called more than once with different values over a frame. For example, when performing bounding box prediction, velocity is integrated with a full frame time step duration. During substepped solves, integration is split into substepCount steps, each with fullFrameDuration / substepCount duration. The final integration pass for unconstrained bodies may be either fullFrameDuration or fullFrameDuration / substepCount, depending on the value of AllowSubstepsForUnconstrainedBodies.

void PrepareForIntegration(float dt)

Parameters

dt float

Current integration time step duration.

Remarks

This is typically used for precomputing anything expensive that will be used across velocity integration.