|
|
| CollisionHandler (Manager &mManager) |
| |
|
std::vector< ColliderComponent * > | getColliders (std::initializer_list< Entity::GroupLabel > const &groupLabels, std::initializer_list< Entity::TeamLabel > const &teamLabels={}, bool negateTeam=false) |
| |
| template<typename T > |
| T | getAnyIntersection (Entity *entity, Vector2D posMod={}, std::initializer_list< Entity::GroupLabel > const &groupLabels={}, std::initializer_list< Entity::TeamLabel > const &teamLabels={}, bool negateTeam=false) |
| | Tests entity against all entities with the specified labels for a collision.
|
| |
|
void | update () |
| |
| template<> |
| IntersectionBitSet | getAnyIntersection (Entity *entity, Vector2D posMod, std::initializer_list< Entity::GroupLabel > const &groupLabels, std::initializer_list< Entity::TeamLabel > const &teamLabels, bool negateTeam) |
| |
| template<> |
| Entity * | getAnyIntersection (Entity *entity, Vector2D posMod, std::initializer_list< Entity::GroupLabel > const &groupLabels, std::initializer_list< Entity::TeamLabel > const &teamLabels, bool negateTeam) |
| |
| template<> |
| bool | getAnyIntersection (Entity *entity, Vector2D posMod, std::initializer_list< Entity::GroupLabel > const &groupLabels, std::initializer_list< Entity::TeamLabel > const &teamLabels, bool negateTeam) |
| |
◆ getAnyIntersection() [1/4]
Refer to getAnyIntersection() for more details
- Returns
- A bitset of intersections, describing the directions of intersection. Position
Direction in bitset true if edge in that direction collides
- See also
- Direction
-
IntersectionBitSet
using IntersectionBitSet = std::bitset<DIRECTION_C>;
Example usage for IntersectionBitSet (TransformComponent::update()):
IntersectionBitSet intersections =
(CollisionHandler::getIntersectionWithBounds(entity,
Vector2D(positionChange.x, 0)) |
IntersectionBitSet("0011")) |
(CollisionHandler::getIntersectionWithBounds(entity,
Vector2D(0, positionChange.y)) |
IntersectionBitSet("1100"));
if (intersections.test((size_t)Direction::LEFT) || intersections.test((size_t)Direction::RIGHT))
positionChange.x = 0;
if (intersections.test((size_t)Direction::UP) || intersections.test((size_t)Direction::DOWN))
positionChange.y = 0;
◆ getAnyIntersection() [2/4]
◆ getAnyIntersection() [3/4]
Refer to getAnyIntersection() for more details
- Returns
- True if any collision was found, otherwise false
◆ getAnyIntersection() [4/4]
Tests entity against all entities with the specified labels for a collision.
Tests the given entity against every other entity with the specified labels for intersections between their collison boxes. If the primary entity has no ColliderComponent, the equivalent of no collision is returned immediately, other entities are skipped if they don't have a ColliderComponent
- Parameters
-
| entity | The primary entity to check against. Return values will be relative to this entity |
| posMod | Modifier to apply toposition before checking collisions. |
| groupLabels | Entities need to have at least one listed GroupLabels to get checked against |
| teamLabels | Entities need to have one of the specified TeamLabels to get checked against |
| negateTeam | If set to true, entities will only be checked against if they don't have one of the specified TeamLabels |
- See also
- ColliderComponent
The documentation for this class was generated from the following files: