Navigation
Unreal Engine C++ API Reference > Runtime > Chaos > Chaos > Collision
References
Module | Chaos |
Header | /Engine/Source/Runtime/Experimental/Chaos/Public/Chaos/Collision/CollisionConstraintAllocator.h |
Include | #include "Chaos/Collision/CollisionConstraintAllocator.h" |
Syntax
class FCollisionConstraintAllocator
Remarks
All constraint pointers are persistent in memory until Destroy() is called, or until they are pruned.
This allocator maintains the set of all overlapping particle pairs, with each overlapping particle pair managed by a FParticlePairMidPhase object. the MidPhase object is what actually calls the Narrow Phase and maintains the set of collision constraints for all the shape pairs on the particles.
Constraints are allocated during the collision detection phase and retained between ticks. An attempt to create a constraint for the same shape pair as seen on the previous tick will return the existing collision constraint with all of its data intact.
The allocator also keeps a list of Standard and Swept collision constraints that are active for the current tick. This list gets reset and rebuilt every frame during collision detection. It may get added to by the IslandManager if some islands are woken following collision detection.
The allocators Epoch counter is used to determine whether a constraint (or midphase object) generated any contacts for the current frame. When a midphase creates or updates a constraint, it copies the current Epoch counter.
The Midphase list is pruned at the end of each tick so if particles are destroyed or a particle pair is no longer overlapping, the collisions will be destroyed.
When particles are destroyed, we do not immediately destroy the MidPhases (or Collisions) that are associoated with the particle. Instead, we clear the particle pointer from them, but leave their destruction to the pruning process. This avoids the need to parse collision and midphase lists whenever a particle is disabled.
NOTE: To reduce RBAN memory use, we do not create any collision blocks until the first call to CreateCollisionConstraint (see ConstraintPool initialization)
Constructors
Type | Name | Description | |
---|---|---|---|
![]() |
|||
![]() |
|||
![]() |
FCollisionConstraintAllocator
(
const int32 InNumCollisionsPerBlock |
Destructors
Type | Name | Description | |
---|---|---|---|
![]() |
Functions
Type | Name | Description | |
---|---|---|---|
![]() |
void | AddResimConstraints
(
const TArray< FPBDCollisionConstraint >& InConstraints, |
Add a set of pre-built constraints and build required internal mapping data This is used by the resim cache when restoring constraints after a desync. |
![]() |
void | Called at the start of the tick to prepare for collision detection. Resets the list of active contacts. | |
![]() |
void | BeginFrame () |
Called at the start of the frame to clear the frame's active collision list. |
![]() |
void | Called after collision detection to clean up Prunes unused contacts. | |
![]() ![]() |
TArrayView< FPBDCollisionConstraint *const > | The set of sweep collision constraints for the current tick (created or reinstated) | |
![]() ![]() |
TArrayView< const FPBDCollisionConstraint *const > | The set of collision constraints for the current tick (created or reinstated) | |
![]() ![]() |
TArrayView< FPBDCollisionConstraint *const > | The set of collision constraints for the current tick (created or reinstated) | |
![]() |
FCollisionContextAllocator * | GetContextAllocator
(
const int32 Index |
|
![]() ![]() |
int32 | ||
![]() |
bool | IsConstraintExpired
(
const FPBDCollisionConstraint& Constraint |
Has the constraint expired. |
![]() |
void | If we add new constraints after collision detection, do what needs to be done to add them to the system. | |
![]() |
void | Collect all the midphases created on the context allocators (probably on multiple threads) and register them | |
![]() |
void | Called each tick after the graph is updated to remove unused collisions. | |
![]() |
void | RemoveParticle
(
FGeometryParticleHandle* Particle |
Destroy all collision and caches involving the particle Called when a particle is destroyed or disabled (not sleeping). |
![]() |
void | Reset () |
Destroy all constraints. |
![]() |
void | SetCollisionContainer
(
FPBDCollisionConstraints* InCollisionContainer |
|
![]() |
void | SetMaxContexts
(
const int32 MaxContexts |
|
![]() |
void | Sort all the constraints for better solver stability. | |
![]() ![]() |
void | VisitCollisions
(
const TLambda& Visitor |
Iterate over all collisions (write-enabled), including sleeping ones Visitor signature: ECollisionVisitorResult(FPBDCollisionConstraint&) |
![]() ![]() |
void | VisitConstCollisions
(
const TLambda& Visitor |
Iterate over all collisions (read-only), including sleeping ones Visitor signature: ECollisionVisitorResult(const FPBDCollisionConstraint&) |
![]() |
void | VisitMidPhases
(
const TLambda& Visitor |
Iterate over all midphases Visitor signature: ECollisionVisitorResult(FParticlePairMidPhase&) |
Operators
Type | Name | Description | |
---|---|---|---|
![]() |
FCollisionConstraintAllocator & | ||
![]() |
FCollisionConstraintAllocator & | operator=
(
const FCollisionConstraintAllocator& |