cubos::engine::VoxelCollisionShape class

Component which adds a collision shape corresponding to a given voxel grid to an entity, used with a Collider component.

Public types

struct BoxShiftPair
Struct which holds a sub-box of the voxel collision shape, and its shift from the center of the shape.

Constructors, destructors, conversion operators

VoxelCollisionShape() defaulted
Constructs voxel shape with no grid.
VoxelCollisionShape(Asset<VoxelGrid> grid)
Constructs voxel shape with voxel grid.
~VoxelCollisionShape() defaulted
Default destructor.
VoxelCollisionShape(VoxelCollisionShape&& other) noexcept
Move constructor.
VoxelCollisionShape(const VoxelCollisionShape& shape)
Copy constructor.

Public functions

void setGrid(Asset<VoxelGrid>& grid)
Sets the grid.
void insertBox(const cubos::core::geom::Box& box, const glm::vec3& shift)
Inserts a new BoxShiftPair to the list of the class.
auto getBoxes() const -> std::vector<BoxShiftPair>
Getter for the list of BoxShiftPair of the class.

Public variables

Asset<VoxelGrid> grid
Entities voxel grid.

Function documentation

cubos::engine::VoxelCollisionShape::VoxelCollisionShape(Asset<VoxelGrid> grid)

Constructs voxel shape with voxel grid.

Parameters
grid VoxelGrid given in constructor.

cubos::engine::VoxelCollisionShape::VoxelCollisionShape(VoxelCollisionShape&& other) noexcept

Move constructor.

Parameters
other VoxelCollisionShape to move.

cubos::engine::VoxelCollisionShape::VoxelCollisionShape(const VoxelCollisionShape& shape)

Copy constructor.

Parameters
shape VoxelCollisionSHape to copy.

void cubos::engine::VoxelCollisionShape::setGrid(Asset<VoxelGrid>& grid)

Sets the grid.

Parameters
grid to set.

void cubos::engine::VoxelCollisionShape::insertBox(const cubos::core::geom::Box& box, const glm::vec3& shift)

Inserts a new BoxShiftPair to the list of the class.

Parameters
box Box to insert.
shift Shift vector of the box.