BoxShape¶
class BoxShape : public Shape
A box shape, defined by a width, an height, and a depth.
Functions¶
Name | Description |
---|---|
Create | Creates a new BoxShape from a definition. |
BoxShape | Constructs a new BoxShape . |
BoxShape | Constructs a new BoxShape . |
GetHalfWidth | Gets the half width of the BoxShape . |
GetHalfHeight | Gets the half height of the BoxShape . |
GetHalfDepth | Gets the half depth of the BoxShape . |
GetWidth | Gets the width of the BoxShape . |
GetHeight | Gets the height of the BoxShape . |
GetDepth | Gets the depth of the BoxShape . |
SetHalfWidth | Sets the half width of the BoxShape . |
SetHalfHeight | Sets the half height of the BoxShape . |
SetHalfDepth | Sets the half depth of the BoxShape . |
GetShortestDistanceToEdge | Gets the shortest distance to the edge of this shape. |
Contains | Checks if the given position is contained in this shape. |
GetClosestPoint | Gets the closest point to the given location. |
Function Details¶
BoxShape¶
explicit BoxShape(AmReal32 halfWidth, AmReal32 halfHeight, AmReal32 halfDepth)
Constructs a new BoxShape
.
- Parameter
halfWidth
- The half width of the box shape.
- Parameter
halfHeight
- The half height of the box shape.
- Parameter
halfDepth
- The half depth of the box shape.
explicit BoxShape(const AmVec3& position, const AmVec3& dimensions)
Constructs a new BoxShape
.
- Parameter
position
- The position of the box shape.
- Parameter
dimensions
- The dimensions of the box shape.
Contains¶
[[nodiscard]] bool Contains(const AmVec3& location) final
Checks if the given position is contained in this shape.
- Parameter
location
- The 3D position to check.
- Return
true
if the shape contains the given position,false
otherwise.
Create¶
static BoxShape* Create(const BoxShapeDefinition* definition)
Creates a new BoxShape
from a definition.
- Parameter
definition
- The definition of the shape generated from a flatbuffer binary.
Warning
This method is intended for internal usage only.
GetClosestPoint¶
[[nodiscard]] AmVec3 GetClosestPoint(const AmVec3& location) const
Gets the closest point to the given location.
- Parameter
location
- The location to get the closest point for.
- Return
- The closest point to the given location.
GetDepth¶
[[nodiscard]] AmReal32 GetDepth() const
Gets the depth of the BoxShape
.
- Return
- The box shape's depth.
GetHalfDepth¶
[[nodiscard]] AmReal32 GetHalfDepth() const
Gets the half depth of the BoxShape
.
- Return
- The box shape's half depth.
GetHalfHeight¶
[[nodiscard]] AmReal32 GetHalfHeight() const
Gets the half height of the BoxShape
.
- Return
- The box shape's half height.
GetHalfWidth¶
[[nodiscard]] AmReal32 GetHalfWidth() const
Gets the half width of the BoxShape
.
- Return
- The box shape's half width.
GetHeight¶
[[nodiscard]] AmReal32 GetHeight() const
Gets the height of the BoxShape
.
- Return
- The box shape's height.
GetShortestDistanceToEdge¶
[[nodiscard]] AmReal32 GetShortestDistanceToEdge(const AmVec3& location) final
Gets the shortest distance to the edge of this shape.
- Parameter
location
- The location from which calculate the distance.
- Return
- The shortest distance from the location to the edge of this shape. If negative, the given location in outside the shape.
GetWidth¶
[[nodiscard]] AmReal32 GetWidth() const
Gets the width of the BoxShape
.
- Return
- The box shape's width.
SetHalfDepth¶
void SetHalfDepth(AmReal32 halfDepth)
Sets the half depth of the BoxShape
.
- Parameter
halfDepth
- The new box shape's half depth.
SetHalfHeight¶
void SetHalfHeight(AmReal32 halfHeight)
Sets the half height of the BoxShape
.
- Parameter
halfHeight
- The new box shape's half height.
SetHalfWidth¶
void SetHalfWidth(AmReal32 halfWidth)
Sets the half width of the BoxShape
.
- Parameter
halfWidth
- The new box shape's half width.