Skip to content

Namespace Engine::CollisionLayers

Namespace List > Engine > CollisionLayers

Namespace of collision layer helpers shared by ColliderComponent ,CollisionSystem , the editor Inspector and the Lua bindings.More...

Public Attributes

Type Name
std::uint32_t kAllLayers = 0xFFFFFFFFu
Mask value matching every layer: the default for new colliders.
int kDefaultLayer = 0
Layer every new collider starts on (the Default preset).
int kLayerCount = 32
Number of usable layers (one bit each in a 32-bit mask).
std::array< std::string_view, 8 > kLayerNames = /* multi line expression */
Conventional names for the first layers, used by the Inspector and Layers.name() in Lua. Layers past these are named "Layer N". (these can be changed, or directly removed and provide the option to modify them.
int kNamedLayerCount = static\_cast&lt;int&gt;(kLayerNames.size())
Number of entries in kLayerNames .
std::uint32_t kNoLayers = 0u
Mask value matching nothing: use it to make a collider inert.

Public Functions

Type Name
std::uint32_t Bit (int layer)
The single-bit mask of one layer.
int Index (std::string_view name)
Resolves a layer from its name or its number.
std::string Name (int layer)
Display name of a layer: the preset name, or "Layer N" past them.

Detailed Description

A collider belongs to one ColliderComponent::layer and carries a ColliderComponent::mask of the layers it is willing to touch. Two colliders only interact when both masks contain the other's layer, so either side can veto a pair ("this only collides with walls and pickups").

Layers are plain integers in [0, kLayerCount); nothing enforces the names below, they are a convention so the Inspector and Lua scripts can talk about layers without magic numbers.

Public Attributes Documentation

variable kAllLayers

Mask value matching every layer: the default for new colliders.

std::uint32_t Engine::CollisionLayers::kAllLayers;


variable kDefaultLayer

Layer every new collider starts on (the Default preset).

int Engine::CollisionLayers::kDefaultLayer;


variable kLayerCount

Number of usable layers (one bit each in a 32-bit mask).

int Engine::CollisionLayers::kLayerCount;


variable kLayerNames

Conventional names for the first layers, used by the Inspector and Layers.name() in Lua. Layers past these are named "Layer N". (these can be changed, or directly removed and provide the option to modify them.

std::array<std::string_view, 8> Engine::CollisionLayers::kLayerNames;


variable kNamedLayerCount

Number of entries in kLayerNames .

int Engine::CollisionLayers::kNamedLayerCount;


variable kNoLayers

Mask value matching nothing: use it to make a collider inert.

std::uint32_t Engine::CollisionLayers::kNoLayers;


Public Functions Documentation

function Bit

The single-bit mask of one layer.

inline std::uint32_t Engine::CollisionLayers::Bit (
    int layer
) 

Returns:

0 for out-of-range layers, so callers never shift by >= 32.


function Index

Resolves a layer from its name or its number.

inline int Engine::CollisionLayers::Index (
    std::string_view name
) 

Returns:

The layer index, or -1 when name matches nothing.


function Name

Display name of a layer: the preset name, or "Layer N" past them.

inline std::string Engine::CollisionLayers::Name (
    int layer
) 



The documentation for this class was generated from the following file /home/runner/work/r-type/r-type/Engine/include/Components/CollisionLayers.hpp