Table of Contents

Struct BroadPhaseRayBatcher<TRayTester>

Namespace
BepuPhysics.CollisionDetection
Assembly
BepuPhysics.dll

Helps test the broad phase's active and static trees with a custom leaf tester.

public struct BroadPhaseRayBatcher<TRayTester> : IDisposable where TRayTester : struct, IBroadPhaseBatchedRayTester

Type Parameters

TRayTester

Type used to test rays against leaves.

Implements
Inherited Members

Constructors

BroadPhaseRayBatcher(BufferPool, BroadPhase, TRayTester, int)

Constructs a ray batcher for the broad phase and initializes its backing resources.

public BroadPhaseRayBatcher(BufferPool pool, BroadPhase broadPhase, TRayTester rayTester, int batcherRayCapacity = 2048)

Parameters

pool BufferPool

Pool to pull resources from.

broadPhase BroadPhase

Broad phase to be tested.

rayTester TRayTester

Ray tester used to test leaves found by the broad phase tree traversals.

batcherRayCapacity int

Maximum number of rays to execute in each traversal. This should typically be chosen as the highest value which avoids spilling data out of L2 cache.

Methods

Add(ref Vector3, ref Vector3, float, int)

Adds a ray to the batcher to test against the broad phase trees. If the underlying ray batcher hits its maximum capacity, all the accumulated rays will be tested against the broad phase trees and the accumulator will be reset.

public void Add(ref Vector3 origin, ref Vector3 direction, float maximumT, int id = 0)

Parameters

origin Vector3

Origin of the ray to test against the tree.

direction Vector3

Direction of the ray to test against the tree.

maximumT float

Maximum distance that the ray will travel in units of the ray's length.

id int

Identifier value for the ray. Leaf tests will have access to the id.

Dispose()

Disposes the underlying batcher resources.

public void Dispose()

Flush()

Tests any accumulated rays against the broad phase trees and then resets the batcher.

public void Flush()