![]() |
UDocumentation UE5.7 10.02.2026 (Source)
API documentation for Unreal Engine 5.7
|
Produce collisions for a particle pair A FParticlePairMidPhase object is created for every particle pair whose bounds overlap. It is responsible for building a set of potentially colliding shape pairs and running collision detection on those pairs each tick. More...
#include <ParticlePairMidPhase.h>
Inheritance diagram for Chaos::FParticlePairMidPhase:Classes | |
| union | FFlags |
Public Member Functions | |
| UE_NONCOPYABLE (FParticlePairMidPhase) | |
| CHAOS_API | FParticlePairMidPhase (const EParticlePairMidPhaseType InMidPhaseType) |
| virtual CHAOS_API | ~FParticlePairMidPhase () |
| EParticlePairMidPhaseType | GetMidPhaseType () const |
| CHAOS_API void | Init (FGeometryParticleHandle *InParticle0, FGeometryParticleHandle *InParticle1, const Private::FCollisionParticlePairKey &InKey, const FCollisionContext &Context) |
| Set up the midphase based on the ShapesArrays of the two particles Only intended to be called once right after constructor. We don't do this work in the constructor so that we can reduce the time that the lock is held when allocating new MidPhases. | |
| FGeometryParticleHandle * | GetParticle0 () const |
| FGeometryParticleHandle * | GetParticle1 () const |
| const Private::FCollisionParticlePairKey & | GetKey () const |
| bool | IsValid () const |
| void | CachePrefetch () |
| bool | IsUsedSince (const int32 Epoch) const |
| Have we run collision detection since this Epoch (inclusive) | |
| bool | IsSleeping () const |
| Whether the particle pair is sleeping and therefore contacts should not be culled (they will be reused on wake) | |
| CHAOS_API void | SetIsSleeping (const bool bInIsSleeping, const int32 CurrentEpoch) |
| Update the sleeping state If this switches the state to Awake, it will reactivate any collisions between the particle pair that were active when they went to sleep. | |
| CHAOS_API bool | IsInConstraintGraph () const |
| CHAOS_API void | DetachParticle (FGeometryParticleHandle *Particle) |
| Destroy all collisions and prevent this midphasae from being used any more. Called when one of its particles is destoyed. It will be culled at the next Prune in the CollisionConstraintAllocator. We don't delete it immediately so that we don't have to remove it from either Particle's ParticleCollisions array (which is O(N) and unnecessary when the particles are being destroyed) | |
| CHAOS_API void | Reset () |
| Delete all cached data and collisions. Should be called when a particle changes its shapes. | |
| CHAOS_API void | ResetModifications () |
| CHAOS_API void | GenerateCollisions (const FReal CullDistance, const FReal Dt, const FCollisionContext &Context) |
| Create collision constraints for all colliding shape pairs. | |
| CHAOS_API void | InjectCollision (const FPBDCollisionConstraint &Constraint, const FCollisionContext &Context) |
| Copy a collision and activate it This is used by the Resim system to restore saved colisions. If there is already a matching constraint it will be overwritten, otherwise a new constraint will be added. | |
| template<typename TLambda > | |
| ECollisionVisitorResult | VisitCollisions (const TLambda &Visitor, const ECollisionVisitorFlags VisitFlags=ECollisionVisitorFlags::VisitDefault) |
| Call a lambda on each active collision constraint This includes sleeping constraints, but skips constraints that are were not used on the last awake tick but are still kept around as an optimization. | |
| template<typename TLambda > | |
| ECollisionVisitorResult | VisitConstCollisions (const TLambda &Visitor, const ECollisionVisitorFlags VisitFlags=ECollisionVisitorFlags::VisitDefault) const |
| Call a lambda on each active collision constraint. | |
| int32 | GetParticleCollisionsIndex (FGeometryParticleHandle *InParticle) const |
| Cookie for use by FParticleCollisions. | |
| void | SetParticleCollisionsIndex (FGeometryParticleHandle *InParticle, const int32 InIndex) |
| Cookie for use by FParticleCollisions. | |
| void | SetIsActive (bool bIsActive) |
| By default midphases are active. If IsActive is set to false, this midphase will not generate a narrow phase. | |
| void | SetCCDIsActive (bool bCCDIsActive) |
| Override the CCD condition for this mid-phase. Used by the MidPhase modifier and gets reset every frame. | |
| void | SetConvexOptimizationIsActive (bool bSetConvexOptimizationIsActive) |
| virtual void | SetConvexOptimizationIsActive (bool bSetConvexOptimizationIsActive, TFunctionRef< void(FPBDCollisionConstraint *)> OnDestroyingCollision) |
| Override whether convex optimization if used this mid-phase. Used by the MidPhase modifier and gets reset every frame. NOTE: when this setting is changed, collisions will be destroyed so any external systems referencing them will need to drop their references. | |
| bool | IsCCD () const |
| bool | IsCCDActive () const |
Protected Member Functions | |
| virtual void | ResetImpl ()=0 |
| virtual void | BuildDetectorsImpl ()=0 |
| Build the list of potentially colliding shape pairs. This is all the shape pairs in the partilces' shapes arrays that pass the collision filter. | |
| virtual int32 | GenerateCollisionsImpl (const FRealSingle Dt, const FRealSingle CullDistance, const FVec3f &RelativeMovement, const FCollisionContext &Context)=0 |
| virtual void | WakeCollisionsImpl (const int32 CurrentEpoch)=0 |
| virtual void | InjectCollisionImpl (const FPBDCollisionConstraint &Constraint, const FCollisionContext &Context)=0 |
| CHAOS_API bool | ShouldEnableCCDSweep (const FReal Dt) |
| Decide whether we should have CCD enabled on this constraint. | |
| CHAOS_API void | InitThresholds () |
Produce collisions for a particle pair A FParticlePairMidPhase object is created for every particle pair whose bounds overlap. It is responsible for building a set of potentially colliding shape pairs and running collision detection on those pairs each tick.
| Chaos::FParticlePairMidPhase::FParticlePairMidPhase | ( | const EParticlePairMidPhaseType | InMidPhaseType | ) |
|
virtual |
Build the list of potentially colliding shape pairs. This is all the shape pairs in the partilces' shapes arrays that pass the collision filter.
Implemented in Chaos::FShapePairParticlePairMidPhase, Chaos::FGenericParticlePairMidPhase, and Chaos::FSphereApproximationParticlePairMidPhase.
|
inline |
|
static |
| void Chaos::FParticlePairMidPhase::DetachParticle | ( | FGeometryParticleHandle * | Particle | ) |
Destroy all collisions and prevent this midphasae from being used any more. Called when one of its particles is destoyed. It will be culled at the next Prune in the CollisionConstraintAllocator. We don't delete it immediately so that we don't have to remove it from either Particle's ParticleCollisions array (which is O(N) and unnecessary when the particles are being destroyed)
| void Chaos::FParticlePairMidPhase::GenerateCollisions | ( | const FReal | CullDistance, |
| const FReal | Dt, | ||
| const FCollisionContext & | Context | ||
| ) |
Create collision constraints for all colliding shape pairs.
|
protectedpure virtual |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Cookie for use by FParticleCollisions.
| void Chaos::FParticlePairMidPhase::Init | ( | FGeometryParticleHandle * | InParticle0, |
| FGeometryParticleHandle * | InParticle1, | ||
| const Private::FCollisionParticlePairKey & | InKey, | ||
| const FCollisionContext & | Context | ||
| ) |
Set up the midphase based on the ShapesArrays of the two particles Only intended to be called once right after constructor. We don't do this work in the constructor so that we can reduce the time that the lock is held when allocating new MidPhases.
|
protected |
| void Chaos::FParticlePairMidPhase::InjectCollision | ( | const FPBDCollisionConstraint & | Constraint, |
| const FCollisionContext & | Context | ||
| ) |
Copy a collision and activate it This is used by the Resim system to restore saved colisions. If there is already a matching constraint it will be overwritten, otherwise a new constraint will be added.
|
protectedpure virtual |
|
inline |
|
inline |
| bool Chaos::FParticlePairMidPhase::IsInConstraintGraph | ( | ) | const |
|
inline |
Whether the particle pair is sleeping and therefore contacts should not be culled (they will be reused on wake)
Have we run collision detection since this Epoch (inclusive)
|
inline |
|
static |
| void Chaos::FParticlePairMidPhase::Reset | ( | ) |
Delete all cached data and collisions. Should be called when a particle changes its shapes.
| void Chaos::FParticlePairMidPhase::ResetModifications | ( | ) |
Override the CCD condition for this mid-phase. Used by the MidPhase modifier and gets reset every frame.
|
inline |
|
inlinevirtual |
Override whether convex optimization if used this mid-phase. Used by the MidPhase modifier and gets reset every frame. NOTE: when this setting is changed, collisions will be destroyed so any external systems referencing them will need to drop their references.
By default midphases are active. If IsActive is set to false, this midphase will not generate a narrow phase.
| void Chaos::FParticlePairMidPhase::SetIsSleeping | ( | const bool | bInIsSleeping, |
| const int32 | CurrentEpoch | ||
| ) |
Update the sleeping state If this switches the state to Awake, it will reactivate any collisions between the particle pair that were active when they went to sleep.
|
inline |
Cookie for use by FParticleCollisions.
Decide whether we should have CCD enabled on this constraint.
| Chaos::FParticlePairMidPhase::UE_NONCOPYABLE | ( | FParticlePairMidPhase | ) |
|
inline |
Call a lambda on each active collision constraint This includes sleeping constraints, but skips constraints that are were not used on the last awake tick but are still kept around as an optimization.
| Visitor | functor with signature ECollisionVisitorResult(FPBDCollisionConstraint& Constraint) |
|
inline |
Call a lambda on each active collision constraint.
| Visitor | functor with signature ECollisionVisitorResult(const FPBDCollisionConstraint& Constraint) |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |