SphereShape¶
class SphereShape : public Shape
A sphere shape, defined by a radius.
Functions¶
Name | Description |
---|---|
Create | Creates a new SphereShape from a definition. |
SphereShape | Constructs a new SphereShape . |
GetRadius | Gets the radius of the sphere shape. |
GetDiameter | Gets the diameter of the sphere shape. |
SetRadius | Sets the radius of the sphere shape. |
GetShortestDistanceToEdge | Gets the shortest distance to the edge of this shape. |
Contains | Checks if the given position is contained in this shape. |
Function Details¶
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 SphereShape* Create(const SphereShapeDefinition* definition)
Creates a new SphereShape from a definition.
- Parameter
definition
- The definition of the shape generated from a flatbuffer binary.
Warning
This method is intended for internal usage only.
GetDiameter¶
[[nodiscard]] AmReal32 GetDiameter() const
Gets the diameter of the sphere shape.
- Return
- The sphere's diameter.
GetRadius¶
[[nodiscard]] AmReal32 GetRadius() const
Gets the radius of the sphere shape.
- Return
- The sphere's radius.
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.
SetRadius¶
void SetRadius(AmReal32 radius)
Sets the radius of the sphere shape.
- Parameter
radius
- The sphere's radius.
SphereShape¶
explicit SphereShape(AmReal32 radius)
Constructs a new SphereShape
.
- Parameter
radius
- The sphere's radius.