cubos::engine::CollisionLayers struct

Component that contains the collision layers where the collider appears in. Check also CollisionMask.

Public functions

void setLayerValue(unsigned int layerNumber, bool newValue)
Based on newValue, enables or disables the specified layerNumber.
auto getLayerValue(unsigned int layerNumber) const -> bool
Returns whether or not the specified layerNumber is enabled.

Public variables

uint32_t value
Layers of the collider.

Function documentation

void cubos::engine::CollisionLayers::setLayerValue(unsigned int layerNumber, bool newValue)

Based on newValue, enables or disables the specified layerNumber.

Parameters
layerNumber Layer number between 0 and 31.
newValue true enables the layer. false disables the layer.

bool cubos::engine::CollisionLayers::getLayerValue(unsigned int layerNumber) const

Returns whether or not the specified layerNumber is enabled.

Parameters
layerNumber Layer number between 0 and 31.

Variable documentation

uint32_t cubos::engine::CollisionLayers::value

Layers of the collider.

There are 32 layers, from 0 to 31. A collider can belong to any number of layers.

Internally, the layers go from right to left, meaning, layer 0 is the least significant bit and layer 31 the most significant bit. Any type of number can be used to manually set the layers, just make sure the binary representation has all the bits corresponding to the wanted layers set to 1.

By default, colliders appear only in layer 0.