CollisionMask struct
Component that contains the mask of layers which the collider can collide with. Check also CollisionLayers.
Public functions
- void setLayerValue(unsigned int layerNumber, bool newValue)
- Based on
newValue, enables or disables the specifiedlayerNumberin the mask. - auto getLayerValue(unsigned int layerNumber) const -> bool
- Returns whether or not the specified
layerNumberis enabled.
Public variables
- uint32_t value
- Mask of layers which the collider can collide with.
Function documentation
void cubos:: engine:: CollisionMask:: setLayerValue(unsigned int layerNumber,
bool newValue)
Based on newValue, enables or disables the specified layerNumber in the mask.
| Parameters | |
|---|---|
| layerNumber | Layer number between 0 and 31. |
| newValue | true enables the layer. false disables the layer. |
bool cubos:: engine:: CollisionMask:: 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:: CollisionMask:: value
Mask of layers which the collider can collide with.
There are 32 layers, from 0 to 31. A collider can collide with 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 collide with layer 0.