Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
`Multibody::clear_dof_couplings` to remove DoF couplings.
- `rapier3d-urdf`: `UrdfLink::urdf_link_index` and `UrdfJoint::urdf_joint_index` (and related) map the
loaded links and joints to their URDF counterparts, even when empty links are squeezed.
- `rapier3d-mjcf`: `MjcfContactHooks::is_excluded` and `MjcfContactHooks::pair_override` to query the
contact rules of a model.

### Fixed

Expand Down
24 changes: 18 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,22 @@ The easiest way to get started with Rapier is to:

1. Read the [user-guides](https://www.rapier.rs/docs/).
2. Play with the examples: `cargo run --release --bin all_examples2` and `cargo run --release --bin all_examples3`.
Their source code are available on the `examples2d/` and `examples3d/` directory.
The examples of every language and integration are listed [below](#examples).
3. Don't hesitate to ask for help on [Discord](https://discord.gg/vt9DJSW), or by opening an issue on GitHub.

## Examples

| Variant | Examples | User-guide snippets |
| --- | --- | --- |
| Rust | [`examples2d/`](examples2d/), [`examples3d/`](examples3d/), [`examples3d-f64/`](examples3d-f64/) | [2D](website/docs-examples/2d/rust/examples/), [3D](website/docs-examples/3d/rust/examples/) |
| C | [`c/examples/`](c/examples/), testbed scenes in [`c/testbed/examples2d/`](c/testbed/examples2d/) and [`c/testbed/examples3d/`](c/testbed/examples3d/) | [2D](website/docs-examples/2d/c/examples/), [3D](website/docs-examples/3d/c/examples/) |
| JavaScript | testbed demos in [`typescript/testbed2d/src/demos/`](typescript/testbed2d/src/demos/) and [`typescript/testbed3d/src/demos/`](typescript/testbed3d/src/demos/) | [2D](website/docs-examples/2d/javascript/src/snippets/), [3D](website/docs-examples/3d/javascript/src/snippets/) |
| Python | [`python/examples/`](python/examples/), testbed scenes in [`python/rapier-testbed/rapier_testbed/examples3/`](python/rapier-testbed/rapier_testbed/examples3/) | [3D](website/docs-examples/3d/python/) |
| Bevy plugin | [`bevy_rapier2d/examples/`](https://github.com/dimforge/bevy_rapier/tree/master/bevy_rapier2d/examples) and [`bevy_rapier3d/examples/`](https://github.com/dimforge/bevy_rapier/tree/master/bevy_rapier3d/examples) in the [bevy_rapier](https://github.com/dimforge/bevy_rapier) repository | [2D](website/docs-examples/2d/bevy/examples/), [3D](website/docs-examples/3d/bevy/examples/) |

The user-guide snippets are the code shown in the [user guide](https://rapier.rs/docs/): they are compiled (and, for
C and Python, run) to make sure the guide stays up to date.

## Performance

SIMD-batched constraint solving and contact processing are always on: the
Expand All @@ -74,11 +87,10 @@ and Unity/Unreal integration guidance. The bindings cover 2D/3D and f32/f64, inc

## Python bindings

Python bindings are under development. They ship as four PyPI packages —
`rapier2d`, `rapier3d`, `rapier2d-f64`, `rapier3d-f64` — one per
(dimension, scalar) flavor. See [`python/README.md`](python/README.md) for how
to build the bindings, the docs, and the testbed from a checkout, and
[`python/docs/`](python/docs/) for the API documentation.
The Python bindings ship as a single package, `rapier3d`, wrapping the 3D engine with 32-bit floats (there
are no 2D or f64 Python bindings yet). See [`python/README.md`](python/README.md) for how to build the bindings,
the docs, and the testbed from a checkout, [`python/docs/`](python/docs/) for the API documentation, and the
[user guide](https://rapier.rs/docs/) for its Python version.

## AI coding disclaimer and policy

Expand Down
6 changes: 6 additions & 0 deletions c/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ Install each dimension/precision configuration to a separate prefix. When shippi
a shared-library build, include the library and configure its runtime search path
(on Windows, place the DLL beside your executable).

Without CMake, define `RAPIER_DIM2`/`RAPIER_DIM3`, `RAPIER_F32`/`RAPIER_F64`, and
`RAPIER_FEM`, `RAPIER_ROBOTICS`, `RAPIER_PARALLEL` for the enabled library features
yourself. Call `r3CheckAbi` (or `r2CheckAbi`) at startup, as in the
[C example](examples/falling_ball.c): it fails when these defines change a structure
layout of the linked library.

## Run the testbed

```sh
Expand Down
3 changes: 2 additions & 1 deletion c/doxygen/reference.dox
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ RAII ownership; they do not change the C ABI.
@section selection Build selection
Define exactly one of `RAPIER_DIM2` / `RAPIER_DIM3` and one of
`RAPIER_F32` / `RAPIER_F64` before including the headers. The defaults are 3D/f32.
Flags must match the linked library; CheckAbi checks version and core layouts.
Flags must match the linked library, including `RAPIER_FEM` and `RAPIER_ROBOTICS`.
CheckAbi, given ABI_FEATURES, checks the version, core layouts, and these feature defines.
PodLayout exposes additional structure sizes for foreign-language bindings.
Use uint32_t for ABI booleans, not C/C++ bool; inputs must be 0 or 1.

Expand Down
4 changes: 2 additions & 2 deletions c/examples/RapierNative.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public sealed class World : SafeHandleZeroOrMinusOneIsInvalid
public World() : base(true) { }
protected override bool ReleaseHandle() { return r3FreeWorld(handle) == 0; }
}
[DllImport(Library, CallingConvention=CallingConvention.Cdecl, ExactSpelling=true)] static extern uint r3CheckAbi(uint version,uint dimension,UIntPtr realSize,UIntPtr vectorSize,UIntPtr poseSize);
[DllImport(Library, CallingConvention=CallingConvention.Cdecl, ExactSpelling=true)] static extern uint r3CheckAbi(uint version,uint dimension,UIntPtr realSize,UIntPtr vectorSize,UIntPtr poseSize,uint features);
[DllImport(Library, CallingConvention=CallingConvention.Cdecl, ExactSpelling=true)] static extern IntPtr r3LastError();
[DllImport(Library, CallingConvention=CallingConvention.Cdecl, ExactSpelling=true)] static extern uint r3LastStatus();
[DllImport(Library, CallingConvention=CallingConvention.Cdecl, ExactSpelling=true)] static extern World r3NewWorld();
Expand All @@ -64,7 +64,7 @@ static void Check(uint status)
// The native library must be installed for the process architecture before invoking this method.
public static Vector SimulateOneSecond()
{
Check(r3CheckAbi(1,3,(UIntPtr)4,(UIntPtr)Marshal.SizeOf<Vector>(),(UIntPtr)Marshal.SizeOf<Pose>()));
Check(r3CheckAbi(1,3,(UIntPtr)4,(UIntPtr)Marshal.SizeOf<Vector>(),(UIntPtr)Marshal.SizeOf<Pose>(),0));
PodLayout layout = r3PodLayout();
if (layout.rigidBodyDesc != (UIntPtr)Marshal.SizeOf<RigidBodyDesc>())
throw new InvalidOperationException("RigidBodyDesc layout does not match the native library.");
Expand Down
2 changes: 1 addition & 1 deletion c/examples/falling_ball.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
int main(void) {
CHECK(RAPIER_FN(CheckAbi)(RAPIER_CONST(ABI_VERSION), RAPIER_CONST(DIMENSION),
sizeof(RAPIER_TYPE(Real)), sizeof(RAPIER_TYPE(Vector)),
sizeof(RAPIER_TYPE(Pose))));
sizeof(RAPIER_TYPE(Pose)), RAPIER_CONST(ABI_FEATURES)));

RAPIER_TYPE(World) *world = RAPIER_FN(NewWorld)();
CHECK(RAPIER_FN(LastStatus)());
Expand Down
Loading
Loading