Navigation
API > API/Runtime > API/Runtime/Chaos
Description
Sweep a particle against all other particles that it may hit. The particles are visited in a semi-random order, depending on how the particles are held in the spatial acceleration. The provided filter policies can be used to reject particle pairs or shape pairs. The collector policy chooses which sweep result(s) to keep.
| Name | Chaos::Private::SimSweepParticle |
| Type | function |
| Header File | /Engine/Source/Runtime/Experimental/Chaos/Public/Chaos/Collision/SimSweep.h |
| Include Path | #include "Chaos/Collision/SimSweep.h" |
namespace Chaos
{
namespace Private
{
template<typename TParticleFilter, typename TShapeFilter, typename THitCollector>
void Chaos::Private::SimSweepParticle
(
ISpatialAcceleration < FAccelerationStructureHandle , FReal, 3 > * SpatialAcceleration,
const FGeometryParticleHandle * SweptParticle,
const FVec3 & StartPos,
const FRotation3 & Rot,
const FVec3 & Dir,
const FReal Length,
TParticleFilter & ParticleFilter,
TShapeFilter & ShapeFilter,
THitCollector & HitCollector
)
}
}
Parameters
| Name | Remarks |
|---|---|
| TParticleFilter | A custom filter functor with the signature bool(const FGeometryParticleHandle SweptParticle, const FGeometryParticleHandle OtherParticle) used to accept/reject particle pairs. It should return true if the particle pair should be considered for a sweep check. |
| TShapeFilter | A custom filter functor with the signature bool(const FPerShapeData SweptShape, const FImplicitObject SweptImplicit, const FPerShapeData OtherShape, const FImplicitObject OtherImplicit) used to accept/reject shapes pairs. It should return true if the pair should be considered for a sweep check. |
| THitCollector | A hit collector functor with signature bool(const FVec3& Dir, const FReal Length, const FSimSweepParticleHit& InHit). It should return true to continue checking further objects, or false to stop any further sweeping. |
| SweptParticle | The particle to be swept |
| StartPos | The start position of the particle to be swept |
| Rot | The rotation to use for the sweep |
| Dir | The direction of the sweep (must be normalized) |
| Length | The sweep length |
| ParticleFilter | The filter to use to accept/reject particle pairs |
| ShapeFilter | The filter to use to accept/reject shape pairs within the particle pairs |
| HitCollector | Hits are passed to the collector one at a time in a semi-random order (i.e., they are not sorted by TOI) |
See Also
-
FSimSweepParticleFilterBroadPhase which provides the standard broadphase filter used in collision detection.
-
FSimSweepShapeFilterNarrowPhase which provides the standard narrowphase filter used in collision detection.
-
FSimSweepCollectorFirstHit which keeps the hit with the lowest time of impact and the most opposing normal if there is a tie.