Aegis2D
Modular C++26 2D game engine for networked games
Loading...
Searching...
No Matches
aegis2d::ecs::Collider Struct Reference

Axis-aligned box an entity collides with. More...

#include <aegis2d/ecs/components.hpp>

Public Attributes

Vec2 size {}
 Width and height of the box, in logical pixels.
 
Vec2 offset {}
 Center of the box relative to the entity's position.
 
std::uint32_t layer = 0
 Layers the entity belongs to, one bit each.
 
std::uint32_t mask = 0
 Layers the entity can collide with.
 

Detailed Description

Axis-aligned box an entity collides with.

The box is centered on Transform::position plus offset. Layers are bit masks: layer is what the entity is (player, enemy, player missile...) and mask is what it can hit; the game defines the bits. The default collider has no layer and no mask, so it collides with nothing.

Member Data Documentation

◆ layer

std::uint32_t aegis2d::ecs::Collider::layer = 0

Layers the entity belongs to, one bit each.

◆ mask

std::uint32_t aegis2d::ecs::Collider::mask = 0

Layers the entity can collide with.

◆ offset

Vec2 aegis2d::ecs::Collider::offset {}

Center of the box relative to the entity's position.

◆ size

Vec2 aegis2d::ecs::Collider::size {}

Width and height of the box, in logical pixels.


The documentation for this struct was generated from the following file: