|
Avara3D 0.2.0
C++ API reference
|
Describes collision geometry used by one or more PhysicsBody objects. More...
#include <a3d/physics/shape/PhysicsShape.h>
Public Types | |
| enum class | Type : uint8_t { Primitive , BoundingBox , ConvexHull , ConcavePolyhedron } |
| Collision-geometry representation requested for a PhysicsShape. More... | |
| using | Source = std::variant< std::monostate, std::weak_ptr< Mesh >, std::weak_ptr< Node > > |
| Weak source object used to derive collision geometry, or no source for primitive shapes. More... | |
Public Member Functions | |
| PhysicsShape (Type type, const std::shared_ptr< Mesh > &mesh) | |
Creates a PhysicsShape of type derived from mesh. More... | |
| PhysicsShape (Type type, const std::shared_ptr< Node > &node) | |
Creates a PhysicsShape of type from mesh geometry in the node hierarchy. More... | |
| virtual Type | type () const |
| Returns the collision-geometry type. More... | |
| virtual void | type (Type type) |
| Validates the requested collision-geometry type. More... | |
| Source | source () const |
| Returns the weak Mesh or Node source, or std::monostate for a source-less primitive shape. More... | |
Static Public Member Functions | |
| static std::shared_ptr< PhysicsShape > | BoundingBoxShape (const std::shared_ptr< Mesh > &mesh) |
Creates a bounding-box collision shape derived from mesh. More... | |
| static std::shared_ptr< PhysicsShape > | BoundingBoxShape (const std::shared_ptr< Node > &node) |
Creates a bounding-box collision shape from mesh geometry in the node hierarchy. More... | |
| static std::shared_ptr< PhysicsShape > | ConvexHullShape (const std::shared_ptr< Mesh > &mesh) |
Creates a convex-hull collision shape derived from mesh. More... | |
| static std::shared_ptr< PhysicsShape > | ConvexHullShape (const std::shared_ptr< Node > &node) |
Creates a convex-hull collision shape from mesh geometry in the node hierarchy. More... | |
| static std::shared_ptr< PhysicsShape > | ConcavePolyhedronShape (const std::shared_ptr< Mesh > &mesh) |
Creates a concave-polyhedron collision shape derived from mesh. More... | |
| static std::shared_ptr< PhysicsShape > | ConcavePolyhedronShape (const std::shared_ptr< Node > &node) |
Creates a concave-polyhedron collision shape from mesh geometry in the node hierarchy. More... | |
Describes collision geometry used by one or more PhysicsBody objects.
A PhysicsShape may derive its collision geometry from a Mesh, from the mesh hierarchy beneath a Node, or from a specialized primitive PhysicsShape subclass. Mesh and Node sources are retained weakly, so constructing a shape does not extend the lifetime of its source object. The source and any mesh geometry used to build the collision shape must remain alive for as long as the PhysicsShape is in use.
Definition at line 37 of file PhysicsShape.h.
| using a3d::PhysicsShape::Source = std::variant<std::monostate, std::weak_ptr<Mesh>, std::weak_ptr<Node> > |
Weak source object used to derive collision geometry, or no source for primitive shapes.
Definition at line 52 of file PhysicsShape.h.
|
strong |
Collision-geometry representation requested for a PhysicsShape.
Definition at line 43 of file PhysicsShape.h.
Creates a PhysicsShape of type derived from mesh.
The source Mesh is retained weakly and must be non-null.
Creates a PhysicsShape of type from mesh geometry in the node hierarchy.
The source Node is retained weakly and must be non-null. Descendant mesh geometry is included using the descendants' local transforms.
|
static |
Creates a bounding-box collision shape derived from mesh.
|
static |
Creates a bounding-box collision shape from mesh geometry in the node hierarchy.
|
static |
Creates a concave-polyhedron collision shape derived from mesh.
|
static |
Creates a concave-polyhedron collision shape from mesh geometry in the node hierarchy.
|
static |
Creates a convex-hull collision shape derived from mesh.
|
static |
Creates a convex-hull collision shape from mesh geometry in the node hierarchy.
| Source a3d::PhysicsShape::source | ( | ) | const |
|
virtual |
Returns the collision-geometry type.
Reimplemented in a3d::BoxPhysicsShape, a3d::CapsulePhysicsShape, a3d::ConePhysicsShape, a3d::CylinderPhysicsShape, a3d::FinitePlanePhysicsShape, a3d::InfinitePlanePhysicsShape, and a3d::SpherePhysicsShape.
|
virtual |
Validates the requested collision-geometry type.
Changing a PhysicsShape type after construction is not currently supported.
| std::logic_error | if type differs from the current type. |
Reimplemented in a3d::BoxPhysicsShape, a3d::CapsulePhysicsShape, a3d::ConePhysicsShape, a3d::CylinderPhysicsShape, a3d::FinitePlanePhysicsShape, a3d::InfinitePlanePhysicsShape, and a3d::SpherePhysicsShape.