CG-Project2
Loading...
Searching...
No Matches
systems::collision Namespace Reference

It contains all utilities to retrieve, handle and update mesh ColliderComponent. More...

Functions

void updateParentCollider (const unsigned int &id)
 Updates the collider of a parent mesh.
void updateCollider (const unsigned int &id)
 Updates the collider of the given entity. If this entity is a parent entity (an entity with a ParentComponent), it will call systems::collision::updateParentCollider() instead.
void updateAllColliders ()
 Updates all the entities collider by calling systems::collision::updateCollider().
ColliderType getColliderType (const unsigned int &id)
 Retrieves the type of the entity collider.
void updateColliderType (const unsigned int &id, const ColliderType &type)
 Updates the collider type of the given entity.
void updateSimulated (const unsigned int &id, const bool &simulated)
 Updates the simulation of the entity in a PhysicWorld.
void compressBoundingBox ()
 This method optimize children bounding box of all parent entities in a single square/cube bounding box.
Pair< glm::vec3 > getCollider (const unsigned int &id)
 Retrieves the collider corners of the entity given.
bool isColliding (const unsigned int &first, const unsigned int &second)
 Calculate if two entities are colliding or not.
std::vector< Pair< unsigned int > > getCollisions ()
 Retrieves all entities overlapping each other using simple AABB detection.

Detailed Description

It contains all utilities to retrieve, handle and update mesh ColliderComponent.

See also
ColliderComponent

Function Documentation

◆ getCollider()

Pair< glm::vec3 > systems::collision::getCollider ( const unsigned int & id)

Retrieves the collider corners of the entity given.

Parameters
idthe entity id
Returns
a pair of (botLeft, topRight) corner

◆ getColliderType()

ColliderType systems::collision::getColliderType ( const unsigned int & id)

Retrieves the type of the entity collider.

Parameters
idthe entity id
Returns
the collider type

◆ getCollisions()

std::vector< Pair< unsigned int > > systems::collision::getCollisions ( )

Retrieves all entities overlapping each other using simple AABB detection.

Returns
a std::vector<Pair<unsigned int>> containing all overlapping entities

◆ isColliding()

bool systems::collision::isColliding ( const unsigned int & first,
const unsigned int & second )

Calculate if two entities are colliding or not.

Parameters
firstthe first entity id
secondthe second entity id
Returns
true if the two entities are colliding

◆ updateCollider()

void systems::collision::updateCollider ( const unsigned int & id)

Updates the collider of the given entity. If this entity is a parent entity (an entity with a ParentComponent), it will call systems::collision::updateParentCollider() instead.

In the other case it will normally update the collider using an Optimized Bounding Box.

See also
ColliderComponent
Parameters
idthe entity id

◆ updateColliderType()

void systems::collision::updateColliderType ( const unsigned int & id,
const ColliderType & type )

Updates the collider type of the given entity.

Parameters
idthe entity id
typethe collider type

◆ updateParentCollider()

void systems::collision::updateParentCollider ( const unsigned int & id)

Updates the collider of a parent mesh.

Note
This method only updates the collider of the father entity and not his children.
Parameters
idthe parent entity id

◆ updateSimulated()

void systems::collision::updateSimulated ( const unsigned int & id,
const bool & simulated )

Updates the simulation of the entity in a PhysicWorld.

Note
If an entity is not simulated means that it's a static entity.
Parameters
idthe entity id
simulatedif true the entity is simulated