A complete dimension/precision-independent simulation using the same source built by the CMake example target.
A complete dimension/precision-independent simulation using the same source built by the CMake example target. The RAPIER_* macros select concrete r2/r3 names.
#include <stdio.h>
#include <stdlib.h>
#define CHECK(call) \
do { \
if ((call) != RAPIER_CONST(OK)) { \
fprintf(stderr, "%s: %s\n", #call, RAPIER_FN(LastError)()); \
exit(EXIT_FAILURE); \
} \
} while (0)
int main(void) {
#if defined(RAPIER_DIM2)
#else
#endif
RAPIER_FN(InsertCollider)(handle, &collider);
for (int i = 0; i < 60; i++) {
}
position =
RAPIER_FN(RigidBody_Translation)(handle);
printf("Ball y after one second: %.3f\n", (double)position.y);
return EXIT_SUCCESS;
}
#define RAPIER_CONST(name)
Select an R2/R3 public constant name.
Definition rapier.h:23
#define RAPIER_FN(name)
Select an r2/r3 public function name.
Definition rapier.h:25
#define RAPIER_TYPE(name)
Select an R2/R3 public type name.
Definition rapier.h:21
Explicit invalid handle values; no owned resources.
Inline value constructors and arithmetic; no allocation or error-state changes.
struct R2Vector translation
Translation vector.
Definition rapier.h:1740
struct R2Pose position
World-space pose.
Definition rapier.h:3084