VoxelCollisionShape class
#include <engine/collisions/shapes/voxel.hpp>
Component which adds a collision shape corresponding to a given voxel grid to an entity, used with a Collider component.
Assumes the VoxelGrid to be centered in the entity space.
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, uint32_t boxId) - Inserts a new BoxShiftPair to the list of the class.
- auto getBoxes() const -> const std::vector<BoxShiftPair>&
- Getter for the list of BoxShiftPair of the class.
Public variables
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:: insertBox(const cubos:: core:: geom:: Box& box,
const glm::vec3& shift,
uint32_t boxId)
Inserts a new BoxShiftPair to the list of the class.
| Parameters | |
|---|---|
| box | Box to insert. |
| shift | Shift vector of the box. |
| boxId | |