Class ConstraintRemover
- Namespace
- BepuPhysics.CollisionDetection
- Assembly
- BepuPhysics.dll
Accumulates constraints to remove from multiple threads, and efficiently removes them all as a batch.
public class ConstraintRemover
- Inheritance
-
ConstraintRemover
- Inherited Members
Constructors
ConstraintRemover(BufferPool, Bodies, Solver, int, int, float)
public ConstraintRemover(BufferPool pool, Bodies bodies, Solver solver, int minimumTypeCapacity = 4, int minimumRemovalCapacity = 128, float previousCapacityMultiplier = 1.25)
Parameters
pool
BufferPoolbodies
Bodiessolver
SolverminimumTypeCapacity
intminimumRemovalCapacity
intpreviousCapacityMultiplier
float
Methods
CreateFlushJobs(bool)
Processes enqueued constraint removals and prepares removal jobs.
public int CreateFlushJobs(bool deterministic)
Parameters
deterministic
boolTrue if the constraint remover should maintain determinism at an added cost, false otherwise.
Returns
- int
The number of removal jobs created. To complete the jobs, execute RemoveConstraintsFromTypeBatch for every index from 0 to the returned job count.
EnqueueRemoval(int, ConstraintHandle)
public void EnqueueRemoval(int workerIndex, ConstraintHandle constraintHandle)
Parameters
workerIndex
intconstraintHandle
ConstraintHandle
MarkAffectedConstraintsAsRemovedFromSolver()
For uses of the ConstraintRemover that fully remove a constraint from the simulation (rather than simply moving it somewhere else), the handle->constraint mapping must be updated. This has to wait until after the multithreaded operations actually complete to avoid corrupting parallel operations.
public void MarkAffectedConstraintsAsRemovedFromSolver()
Postflush()
public void Postflush()
Prepare(IThreadDispatcher)
public void Prepare(IThreadDispatcher dispatcher)
Parameters
dispatcher
IThreadDispatcher
RemoveConstraintsFromBatchReferencedHandles()
public void RemoveConstraintsFromBatchReferencedHandles()
RemoveConstraintsFromBodyLists()
public void RemoveConstraintsFromBodyLists()
RemoveConstraintsFromFallbackBatchReferencedHandles()
public void RemoveConstraintsFromFallbackBatchReferencedHandles()
RemoveConstraintsFromTypeBatch(int)
public void RemoveConstraintsFromTypeBatch(int index)
Parameters
index
int
ReturnConstraintHandles()
Returns the handles associated with all removed constraints to the solver's handle pool.
public void ReturnConstraintHandles()
TryRemoveBodyFromConstrainedKinematicsAndRemoveAllConstraintsForBodyFromFallbackBatch(BodyHandle, int)
public void TryRemoveBodyFromConstrainedKinematicsAndRemoveAllConstraintsForBodyFromFallbackBatch(BodyHandle bodyHandle, int bodyIndex)
Parameters
bodyHandle
BodyHandlebodyIndex
int