Table of Contents

Struct ContinuousDetection

Namespace
BepuPhysics.Collidables
Assembly
BepuPhysics.dll

Defines how a collidable handles collisions with significant velocity.

public struct ContinuousDetection
Inherited Members

Fields

MinimumSweepTimestep

If using Continuous, this defines the minimum progress that the sweep test will make when searching for the first time of impact. Collisions lasting less than MinimumSweepTimestep may be missed by the sweep test. Using larger values can significantly increase the performance of sweep tests.

public float MinimumSweepTimestep

Field Value

float

Mode

The continuous collision detection mode.

public ContinuousDetectionMode Mode

Field Value

ContinuousDetectionMode

SweepConvergenceThreshold

If using Continuous, sweep tests will terminate if the time of impact region has been refined to be smaller than SweepConvergenceThreshold. Values closer to zero will converge more closely to the true time of impact, but for speculative contact generation larger values usually work fine. Larger values allow the sweep to terminate much earlier and can significantly improve sweep performance.

public float SweepConvergenceThreshold

Field Value

float

Properties

AllowExpansionBeyondSpeculativeMargin

Gets whether the continuous collision detection configuration will permit bounding box expansion beyond the calculated speculative margin.

public bool AllowExpansionBeyondSpeculativeMargin { get; }

Property Value

bool

Discrete

No sweep tests are performed. Default speculative contact generation will occur within the speculative margin.

The collidable's bounding box will not be expanded by velocity beyond the speculative margin.

This can be marginally cheaper than Passive modes if using a limited maximum speculative margin. If a Discrete mode collidable is moving quickly and the maximum speculative margin is limited, the fact that its bounding box is not expanded may cause it to miss a collision even with a non-Discrete collidable.

Note that Discrete and Passive only differ if maximum speculative margin is restricted.

public static ContinuousDetection Discrete { get; }

Property Value

ContinuousDetection

Detection settings for the given discrete configuration.

Passive

No sweep tests are performed. Default speculative contact generation will occur within the speculative margin.

The collidable's bounding box and speculative margin will be expanded by velocity.

This is useful when a collidable may move quickly and does not itself require continuous detection, but there exist other collidables with continuous modes that should avoid missing collisions.

public static ContinuousDetection Passive { get; }

Property Value

ContinuousDetection

Detection settings for the passive configuration.

Methods

Continuous(float, float)

Collision detection will start with a sweep test to identify a likely time of impact. Speculative contacts will be generated for the predicted collision.

This mode can capture angular motion with very few ghost collisions. It can, however, miss secondary collisions that would have occurred due to the primary impact's velocity change.

public static ContinuousDetection Continuous(float minimumSweepTimestep = 0.001, float sweepConvergenceThreshold = 0.001)

Parameters

minimumSweepTimestep float

Minimum progress that the sweep test will make when searching for the first time of impact. Collisions lasting less than MinimumProgress may be missed by the sweep test. Using larger values can significantly increase the performance of sweep tests.

sweepConvergenceThreshold float

Threshold against which the time of impact region is compared for sweep termination. If the region has been refined to be smaller than SweepConvergenceThreshold, the sweep will terminate. Values closer to zero will converge more closely to the true time of impact, but for speculative contact generation larger values usually work fine. Larger values allow the sweep to terminate much earlier and can significantly improve sweep performance.

Returns

ContinuousDetection

Detection settings for the given continuous configuration.