Rubeus::Awerere::ACollisionEngine class

The collision engine responsible for resolution of collisions and generating hit events.

Constructors, destructors, conversion operators

ACollisionEngine(const std::vector<RGameObject*>& gameObjects, const float& gridHeight, const float& gridWidth, const float& cellHeight, const float& cellWidth)
Constructor.
~ACollisionEngine()
Destructor.

Public functions

void updateAndAssignFlags(const float& deltaTime)
Assign grid flags for each game object.
void checkCollisions(const int& i)
A helper function to check collision from the a particular index in the world object array.
void collisionResolution()
Attempt a broadphase resolution.
void narrowPhaseResolution(RGameObject& left, RGameObject& right)
Attempt narrowphase resolution on positive results of braodphase resolution.
auto multiplexColliders(ACollider* left, const EColliderType& leftType, ACollider* right, const EColliderType& rightType) -> ACollideData
Invoke collider specific collision algorithms on arguemnts based on the multiplexed collider type.

Function documentation

Rubeus::Awerere::ACollisionEngine::ACollisionEngine(const std::vector<RGameObject*>& gameObjects, const float& gridHeight, const float& gridWidth, const float& cellHeight, const float& cellWidth)

Constructor.

Parameters
gameObjects Reference to array of active gameobjects.
gridHeight Height of collision grid.
gridWidth Width of collision grid.
cellHeight
cellWidth Width of collision grid cell.

void Rubeus::Awerere::ACollisionEngine::updateAndAssignFlags(const float& deltaTime)

Assign grid flags for each game object.

Parameters
deltaTime The timestep for the update

void Rubeus::Awerere::ACollisionEngine::checkCollisions(const int& i)

A helper function to check collision from the a particular index in the world object array.

Parameters
i The gameobject index.

void Rubeus::Awerere::ACollisionEngine::narrowPhaseResolution(RGameObject& left, RGameObject& right)

Attempt narrowphase resolution on positive results of braodphase resolution.

Parameters
left The left argument.
right The right argument.

ACollideData Rubeus::Awerere::ACollisionEngine::multiplexColliders(ACollider* left, const EColliderType& leftType, ACollider* right, const EColliderType& rightType)

Invoke collider specific collision algorithms on arguemnts based on the multiplexed collider type.

Parameters
left Left collider.
leftType Type of Left collider.
right Right collider.
rightType Type of right collider.
Returns Collision data.