17 throw std::runtime_error(std::string(
RAPIER_FN(LastError)()));
23template <
class T, RAPIER_TYPE(Status) (*Free)(T *)>
struct Deleter {
30template <
class T, RAPIER_TYPE(Status) (*Free)(T *)>
31using Owner = std::unique_ptr<T, Deleter<T, Free>>;
50#if defined(RAPIER_DIM3)
54 RAPIER_FN(FreeDynamicRayCastVehicleController)>;
58#if defined(RAPIER_ROBOTICS) && defined(RAPIER_DIM3) && defined(RAPIER_F32)
73 value.bodyType = kind;
79 return RAPIER_FN(BallColliderDesc)(radius);
84 return RAPIER_FN(CuboidColliderDesc)(half_extents);
95 value.lockedAxes = locked_axes;
Optional C++ ownership helpers.
Definition rapier.hpp:13
Owner< R3SoftBodyTearEvent, r3FreeSoftBodyTearEvent > SoftBodyTearEvent
Own a native SoftBodyTearEvent using its matching Free function.
Definition rapier.hpp:42
R3JointDesc joint(uint8_t locked_axes=0)
Return a joint description with the selected locked-axis mask.
Definition rapier.hpp:93
World make_world()
Check the ABI and create an owned world; throw on failure.
Definition rapier.hpp:105
R3ColliderDesc ball(R3Real radius)
Return a POD ball collider description.
Definition rapier.hpp:78
R3ColliderDesc cuboid(R3Vector half_extents)
Return a POD cuboid collider description.
Definition rapier.hpp:83
R3SoftBodyDesc soft_body()
Return native soft-body description defaults.
Definition rapier.hpp:88
Owner< R3SharedShape, r3FreeSharedShape > Shape
Own a native Shape using its matching Free function.
Definition rapier.hpp:35
R3QueryOptions queryOptions()
Return query defaults with no callback or exclusions.
Definition rapier.hpp:100
Owner< R3TriMeshData, r3FreeTriMeshData > TriMeshData
Own a native TriMeshData using its matching Free function.
Definition rapier.hpp:56
Owner< R3MjcfRobotHandles, r3FreeMjcfRobotHandles > MjcfRobotHandles
Own a native MjcfRobotHandles using its matching Free function.
Definition rapier.hpp:66
std::unique_ptr< T, Deleter< T, Free > > Owner
Unique owner of a native pointer; never wrap a borrowed pointer.
Definition rapier.hpp:31
Owner< R3World, r3FreeWorld > World
Own a native World using its matching Free function.
Definition rapier.hpp:33
Owner< R3MjcfRobot, r3FreeMjcfRobot > MjcfRobot
Own a native MjcfRobot using its matching Free function.
Definition rapier.hpp:64
Owner< R3ShapeMesh, r3FreeShapeMesh > ShapeMesh
Own a native ShapeMesh using its matching Free function.
Definition rapier.hpp:44
R3RigidBodyDesc rigid_body(uint32_t kind=R3_DYNAMIC)
Return a POD rigid-body description with the selected body type.
Definition rapier.hpp:71
Owner< R3EventCollector, r3FreeEventCollector > EventCollector
Own a native EventCollector using its matching Free function.
Definition rapier.hpp:37
Owner< R3DynamicRayCastVehicleController, r3FreeDynamicRayCastVehicleController > DynamicRayCastVehicleController
Own a native DynamicRayCastVehicleController using its matching Free function.
Definition rapier.hpp:52
Owner< R3KinematicCharacterController, r3FreeKinematicCharacterController > KinematicCharacterController
Own a native KinematicCharacterController using its matching Free function.
Definition rapier.hpp:46
Owner< R3PidController, r3FreePidController > PidController
Own a native PidController using its matching Free function.
Definition rapier.hpp:49
Owner< R3Bytes, r3FreeBytes > Snapshot
Own a native Snapshot using its matching Free function.
Definition rapier.hpp:39
Owner< R3UrdfRobot, r3FreeUrdfRobot > UrdfRobot
Own a native UrdfRobot using its matching Free function.
Definition rapier.hpp:60
Owner< R3UrdfRobotHandles, r3FreeUrdfRobotHandles > UrdfRobotHandles
Own a native UrdfRobotHandles using its matching Free function.
Definition rapier.hpp:62
void check(R3Status status)
Throw std::runtime_error with LastError when status is not OK.
Definition rapier.hpp:15
#define RAPIER_CONST(name)
Select an R2/R3 public constant name.
Definition rapier.h:32
#define RAPIER_FN(name)
Select an r2/r3 public function name.
Definition rapier.h:34
#define RAPIER_TYPE(name)
Select an R2/R3 public type name.
Definition rapier.h:30
Explicit invalid handle values; no owned resources.
Deleter for an owned pointer; Free must succeed at destruction time.
Definition rapier.hpp:23
void operator()(T *value) const noexcept
Release the pointer through its matching C API function.
Definition rapier.hpp:25