Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
CollisionCollector< ResultTypeArg, TraitsType > Class Template Referenceabstract

Virtual interface that allows collecting multiple collision results. More...

#include <CollisionCollector.h>

Inheritance diagram for CollisionCollector< ResultTypeArg, TraitsType >:
InternalEdgeRemovingCollector

Public Types

using ResultType = ResultTypeArg
 Declare ResultType so that derived classes can use it. More...
 

Public Member Functions

 CollisionCollector ()=default
 Default constructor. More...
 
template<class ResultTypeArg2 >
 CollisionCollector (const CollisionCollector< ResultTypeArg2, TraitsType > &inRHS)
 Constructor to initialize from another collector. More...
 
 CollisionCollector (const CollisionCollector< ResultTypeArg, TraitsType > &inRHS)=default
 
virtual ~CollisionCollector ()=default
 Destructor. More...
 
virtual void Reset ()
 If you want to reuse this collector, call Reset() More...
 
virtual void OnBody (const Body &inBody)
 
void SetContext (const TransformedShape *inContext)
 Set by the collision detection functions to the current TransformedShape that we're colliding against before calling the AddHit function. More...
 
const TransformedShapeGetContext () const
 
virtual void SetUserData (uint64 inUserData)
 This function can be used to set some user data on the collision collector. More...
 
virtual void AddHit (const ResultType &inResult)=0
 This function will be called for every hit found, it's up to the application to decide how to store the hit. More...
 
void UpdateEarlyOutFraction (float inFraction)
 Update the early out fraction (should be lower than before) More...
 
void ResetEarlyOutFraction (float inFraction=TraitsType::InitialEarlyOutFraction)
 Reset the early out fraction to a specific value. More...
 
void ForceEarlyOut ()
 Force the collision detection algorithm to terminate as soon as possible. Call this from the AddHit function when a satisfying hit is found. More...
 
bool ShouldEarlyOut () const
 When true, the collector will no longer accept any additional hits and the collision detection routine should early out as soon as possible. More...
 
float GetEarlyOutFraction () const
 Get the current early out value. More...
 
float GetPositiveEarlyOutFraction () const
 Get the current early out value but make sure it's bigger than zero, this is used for shape casting as negative values are used for penetration. More...
 

Detailed Description

template<class ResultTypeArg, class TraitsType>
class CollisionCollector< ResultTypeArg, TraitsType >

Virtual interface that allows collecting multiple collision results.

Member Typedef Documentation

◆ ResultType

template<class ResultTypeArg , class TraitsType >
using CollisionCollector< ResultTypeArg, TraitsType >::ResultType = ResultTypeArg

Declare ResultType so that derived classes can use it.

Constructor & Destructor Documentation

◆ CollisionCollector() [1/3]

template<class ResultTypeArg , class TraitsType >
CollisionCollector< ResultTypeArg, TraitsType >::CollisionCollector ( )
default

Default constructor.

◆ CollisionCollector() [2/3]

template<class ResultTypeArg , class TraitsType >
template<class ResultTypeArg2 >
CollisionCollector< ResultTypeArg, TraitsType >::CollisionCollector ( const CollisionCollector< ResultTypeArg2, TraitsType > &  inRHS)
inlineexplicit

Constructor to initialize from another collector.

◆ CollisionCollector() [3/3]

template<class ResultTypeArg , class TraitsType >
CollisionCollector< ResultTypeArg, TraitsType >::CollisionCollector ( const CollisionCollector< ResultTypeArg, TraitsType > &  inRHS)
default

◆ ~CollisionCollector()

template<class ResultTypeArg , class TraitsType >
virtual CollisionCollector< ResultTypeArg, TraitsType >::~CollisionCollector ( )
virtualdefault

Destructor.

Member Function Documentation

◆ AddHit()

template<class ResultTypeArg , class TraitsType >
virtual void CollisionCollector< ResultTypeArg, TraitsType >::AddHit ( const ResultType inResult)
pure virtual

This function will be called for every hit found, it's up to the application to decide how to store the hit.

◆ ForceEarlyOut()

template<class ResultTypeArg , class TraitsType >
void CollisionCollector< ResultTypeArg, TraitsType >::ForceEarlyOut ( )
inline

Force the collision detection algorithm to terminate as soon as possible. Call this from the AddHit function when a satisfying hit is found.

◆ GetContext()

template<class ResultTypeArg , class TraitsType >
const TransformedShape * CollisionCollector< ResultTypeArg, TraitsType >::GetContext ( ) const
inline

◆ GetEarlyOutFraction()

template<class ResultTypeArg , class TraitsType >
float CollisionCollector< ResultTypeArg, TraitsType >::GetEarlyOutFraction ( ) const
inline

Get the current early out value.

◆ GetPositiveEarlyOutFraction()

template<class ResultTypeArg , class TraitsType >
float CollisionCollector< ResultTypeArg, TraitsType >::GetPositiveEarlyOutFraction ( ) const
inline

Get the current early out value but make sure it's bigger than zero, this is used for shape casting as negative values are used for penetration.

◆ OnBody()

template<class ResultTypeArg , class TraitsType >
virtual void CollisionCollector< ResultTypeArg, TraitsType >::OnBody ( const Body inBody)
inlinevirtual

When running a query through the NarrowPhaseQuery class, this will be called for every body that is potentially colliding. It allows collecting additional information needed by the collision collector implementation from the body under lock protection before AddHit is called (e.g. the user data pointer or the velocity of the body).

Reimplemented in InternalEdgeRemovingCollector.

◆ Reset()

template<class ResultTypeArg , class TraitsType >
virtual void CollisionCollector< ResultTypeArg, TraitsType >::Reset ( )
inlinevirtual

If you want to reuse this collector, call Reset()

Reimplemented in InternalEdgeRemovingCollector.

◆ ResetEarlyOutFraction()

template<class ResultTypeArg , class TraitsType >
void CollisionCollector< ResultTypeArg, TraitsType >::ResetEarlyOutFraction ( float  inFraction = TraitsType::InitialEarlyOutFraction)
inline

Reset the early out fraction to a specific value.

◆ SetContext()

template<class ResultTypeArg , class TraitsType >
void CollisionCollector< ResultTypeArg, TraitsType >::SetContext ( const TransformedShape inContext)
inline

Set by the collision detection functions to the current TransformedShape that we're colliding against before calling the AddHit function.

◆ SetUserData()

template<class ResultTypeArg , class TraitsType >
virtual void CollisionCollector< ResultTypeArg, TraitsType >::SetUserData ( uint64  inUserData)
inlinevirtual

This function can be used to set some user data on the collision collector.

◆ ShouldEarlyOut()

template<class ResultTypeArg , class TraitsType >
bool CollisionCollector< ResultTypeArg, TraitsType >::ShouldEarlyOut ( ) const
inline

When true, the collector will no longer accept any additional hits and the collision detection routine should early out as soon as possible.

◆ UpdateEarlyOutFraction()

template<class ResultTypeArg , class TraitsType >
void CollisionCollector< ResultTypeArg, TraitsType >::UpdateEarlyOutFraction ( float  inFraction)
inline

Update the early out fraction (should be lower than before)


The documentation for this class was generated from the following file: