Hymn to Beauty
C++ 3D Engine
Physics::TriggerObserver Class Reference

#include <TriggerObserver.hpp>

Inheritance diagram for Physics::TriggerObserver:

Public Types

enum class  IntersectionPhase { Enter , Retained , Leave , None }
 The type of intersection this observer has to its trigger. More...
 

Public Member Functions

 TriggerObserver (btCollisionObject &body)
 Constructor. More...
 
btCollisionObject * GetBulletCollisionObject ()
 Get the Bullet collision object of the observing body. More...
 
IntersectionPhase GetPhase () const
 Get the intersection phase of the observer. More...
 
void PostIntersectionTest ()
 
void OnEnter (const std::function< void()> &handler)
 
void ForgetEnter ()
 
void OnRetain (const std::function< void()> &handler)
 
void ForgetRetain ()
 
void OnLeave (const std::function< void()> &handler)
 
void ForgetLeave ()
 

Detailed Description

Represents an object that listens to intersections against a trigger volume.

Attention
Assumes an object of this type is passed to a trigger that is always the same. If not, intersection phases may be erroneous.
Note
Intended to be used only within the physics related engine classes.

Member Enumeration Documentation

◆ IntersectionPhase

The type of intersection this observer has to its trigger.

Enumerator
Enter 

Intersected during this frame.

Retained 

Intersection after previous enter.

Leave 

Stopped intersecting this frame.

None 

No intersection.

Constructor & Destructor Documentation

◆ TriggerObserver()

Physics::TriggerObserver::TriggerObserver ( btCollisionObject &  body)
explicit

Constructor.

Parameters
bodyRigid body listening to trigger.

Member Function Documentation

◆ ForgetEnter()

void Physics::TriggerObserver::ForgetEnter ( )

Remove handler for when the observer begins intersecting its associated trigger volume.

◆ ForgetLeave()

void Physics::TriggerObserver::ForgetLeave ( )

Remove handler for when the observer stops intersecting its associated trigger volume.

◆ ForgetRetain()

void Physics::TriggerObserver::ForgetRetain ( )

Remove handler for when the observer continues intersecting its associated trigger volume.

◆ GetBulletCollisionObject()

btCollisionObject * Physics::TriggerObserver::GetBulletCollisionObject ( )

Get the Bullet collision object of the observing body.

Returns
Bullet collision object.

◆ GetPhase()

TriggerObserver::IntersectionPhase Physics::TriggerObserver::GetPhase ( ) const

Get the intersection phase of the observer.

Returns
IntersectionPhase indicating the intersection phase relative to the trigger volume.

◆ OnEnter()

void Physics::TriggerObserver::OnEnter ( const std::function< void()> &  handler)

Set up a handler for when the observer begins intersecting its associated trigger volume.

Parameters
handlerHandler function to call.

◆ OnLeave()

void Physics::TriggerObserver::OnLeave ( const std::function< void()> &  handler)

Set up a handler for when the observer stops intersecting its associated trigger volume.

Parameters
handlerHandler function to call.

◆ OnRetain()

void Physics::TriggerObserver::OnRetain ( const std::function< void()> &  handler)

Set up a handler for when the observer continues intersecting its associated trigger volume.

Parameters
handlerHandler function to call.

◆ PostIntersectionTest()

void Physics::TriggerObserver::PostIntersectionTest ( )

Determine new intersection phase after collision test has been applied.


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