Annwvyn::AnnCollisionEvent Class Reference

Collision event between 2 game objects. More...

#include <AnnEvents.hpp>

Inheritance diagram for Annwvyn::AnnCollisionEvent:
Collaboration diagram for Annwvyn::AnnCollisionEvent:

Public Member Functions

 AnnCollisionEvent (AnnGameObject *first, AnnGameObject *second, AnnVect3 position, AnnVect3 normal)
 Event constructor. More...
 
bool hasObject (AnnGameObject *obj) const
 Check if this event is about that object. More...
 
AnnGameObjectgetA () const
 Get first object. More...
 
AnnGameObjectgetB () const
 Get second object. More...
 
AnnVect3 getPosition () const
 Get the position of the "contact point" from that collision. More...
 
AnnVect3 getNormal () const
 Get the normal on the "B" body at the "contact point". More...
 
bool isWallCollision (float scalarApprox=0.0125) const
 
bool isGroundCollision (float scalarApprox=0.125) const
 
bool isCeilingCollision (float scalarApprox=0.125) const
 
- Public Member Functions inherited from Annwvyn::AnnEvent
 AnnEvent ()
 Event constructor. More...
 
AnnEventType getType () const
 

Private Attributes

AnnGameObjecta
 Some naked pointers. More...
 
AnnGameObjectb
 
const AnnVect3 position
 
const AnnVect3 normal
 

Additional Inherited Members

- Protected Attributes inherited from Annwvyn::AnnEvent
AnnEventType type
 

Detailed Description

Collision event between 2 game objects.

Definition at line 362 of file AnnEvents.hpp.

Constructor & Destructor Documentation

◆ AnnCollisionEvent()

AnnCollisionEvent::AnnCollisionEvent ( AnnGameObject first,
AnnGameObject second,
AnnVect3  position,
AnnVect3  normal 
)

Event constructor.

Definition at line 403 of file AnnEvents.cpp.

Member Function Documentation

◆ getA()

AnnGameObject * AnnCollisionEvent::getA ( ) const

Get first object.

Definition at line 419 of file AnnEvents.cpp.

◆ getB()

AnnGameObject * AnnCollisionEvent::getB ( ) const

Get second object.

Definition at line 424 of file AnnEvents.cpp.

◆ getNormal()

AnnVect3 AnnCollisionEvent::getNormal ( ) const

Get the normal on the "B" body at the "contact point".

Definition at line 434 of file AnnEvents.cpp.

◆ getPosition()

AnnVect3 AnnCollisionEvent::getPosition ( ) const

Get the position of the "contact point" from that collision.

Definition at line 429 of file AnnEvents.cpp.

◆ hasObject()

bool AnnCollisionEvent::hasObject ( AnnGameObject obj) const

Check if this event is about that object.

Definition at line 412 of file AnnEvents.cpp.

◆ isCeilingCollision()

bool AnnCollisionEvent::isCeilingCollision ( float  scalarApprox = 0.125) const

Return true if the collision occured with an horizontal plane above the object. See isGroundCollision, it's the same thing, but testing for a negative y on the normal

Parameters
scalarApproxApproximation threshold to consider when testing the equality of the dotProuct and 0.0f

Definition at line 444 of file AnnEvents.cpp.

Here is the call graph for this function:

◆ isGroundCollision()

bool AnnCollisionEvent::isGroundCollision ( float  scalarApprox = 0.125) const

Return true if the collision occurred with an horizontal plane below the object. This is computed by taking !isWallCollision(approx) && normal.y > 0

Parameters
scalarApproxApproximation threshold to consider when testing the equality of the dotProuct and 0.0f

Definition at line 439 of file AnnEvents.cpp.

Here is the call graph for this function:

◆ isWallCollision()

bool AnnCollisionEvent::isWallCollision ( float  scalarApprox = 0.0125) const

Return true if the collision occurred with a vertical plane. Computed with testing the dot product of +Y and the normal.

Parameters
scalarApproxApproximation threshold to consider when testing the equality of the dotProuct and 0.0f

Definition at line 449 of file AnnEvents.cpp.

Here is the caller graph for this function:

Member Data Documentation

◆ a

AnnGameObject* Annwvyn::AnnCollisionEvent::a
private

Some naked pointers.

Definition at line 390 of file AnnEvents.hpp.

◆ b

AnnGameObject * Annwvyn::AnnCollisionEvent::b
private

Definition at line 390 of file AnnEvents.hpp.

◆ normal

const AnnVect3 Annwvyn::AnnCollisionEvent::normal
private

Definition at line 391 of file AnnEvents.hpp.

◆ position

const AnnVect3 Annwvyn::AnnCollisionEvent::position
private

Definition at line 391 of file AnnEvents.hpp.


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