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
AngularIntegrationMode
Gets how the pose integrator should handle angular velocity integration.
AngularIntegrationMode AngularIntegrationMode { get; }
Property Value
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
Methods
Initialize(Simulation)
Performs any required initialization logic after the Simulation instance has been constructed.
void Initialize(Simulation simulation)
Parameters
simulation
SimulationSimulation 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
Vector3WideCurrent body positions.
orientation
QuaternionWideCurrent body orientations.
localInertia
BodyInertiaWideBody'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
intIndex of the worker thread processing this bundle.
dt
Vector<float>Durations to integrate the velocity over. Can vary over lanes.
velocity
BodyVelocityWideVelocity 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
floatCurrent integration time step duration.
Remarks
This is typically used for precomputing anything expensive that will be used across velocity integration.