bevy_rapier3d/lib.rs
1//!
2//! # Official integration of Rapier to the Bevy game engine
3//!
4//! Rapier is a set of two Rust crates `rapier2d` and `rapier3d` for efficient cross-platform
5//! physics simulation. Its target application include video games, animation, robotics, etc.
6//!
7//! The `bevy_rapier` project implements two crates `bevy_rapier2d` and `bevy_rapier3d` which
8//! define physics plugins for the Bevy game engine.
9//!
10//! User documentation for `bevy_rapier` is on [the official Rapier site](https://rapier.rs/docs/).
11//!
12#![warn(missing_docs)]
13
14#[macro_use]
15#[cfg(feature = "serde-serialize")]
16extern crate serde;
17
18pub extern crate nalgebra as na;
19#[cfg(feature = "dim2")]
20pub extern crate rapier2d as rapier;
21#[cfg(feature = "dim3")]
22pub extern crate rapier3d as rapier;
23pub use rapier::parry;
24/// Type aliases to select the right vector/rotation types based
25/// on the dimension used by the engine.
26#[cfg(feature = "dim2")]
27pub mod math {
28 use bevy::math::Vec2;
29 /// The real type (f32 or f64).
30 pub type Real = rapier::math::Real;
31 /// The vector type.
32 pub type Vect = Vec2;
33 /// The integer vector type.
34 pub type IVect = bevy::math::IVec2;
35 /// The rotation type (in 2D this is an angle in radians).
36 pub type Rot = Real;
37 /// The angular vector type (in 2D this is a scalar).
38 pub type AngVector = Real;
39}
40
41/// Type aliases to select the right vector/rotation types based
42/// on the dimension used by the engine.
43#[cfg(feature = "dim3")]
44pub mod math {
45 use bevy::math::{Quat, Vec3};
46 /// The real type (f32 or f64).
47 pub type Real = rapier::math::Real;
48 /// The vector type.
49 pub type Vect = Vec3;
50 /// The integer vector type.
51 pub type IVect = bevy::math::IVec3;
52 /// The rotation type.
53 pub type Rot = Quat;
54 /// The angular vector type.
55 pub type AngVector = Vec3;
56}
57
58/// Components related to physics dynamics (rigid-bodies, velocities, etc.)
59pub mod dynamics;
60/// Components related to physics geometry (colliders, collision-groups, etc.)
61pub mod geometry;
62/// Components and resources related to the physics simulation workflow (events, hooks, etc.)
63pub mod pipeline;
64/// The physics plugin and systems.
65pub mod plugin;
66
67/// Reflection utilities.
68pub mod reflect;
69
70#[cfg(feature = "picking-backend")]
71pub mod picking_backend;
72
73/// Components related to character control.
74pub mod control;
75/// The debug-renderer.
76#[cfg(any(feature = "debug-render-3d", feature = "debug-render-2d"))]
77pub mod render;
78/// Miscellaneous helper functions.
79pub mod utils;
80
81#[cfg(all(
82 feature = "dim3",
83 any(feature = "urdf", feature = "mjcf", feature = "meshloader")
84))]
85pub mod loaders;
86
87/// Groups the most often used types.
88pub mod prelude {
89 pub use crate::control::*;
90 pub use crate::dynamics::*;
91 pub use crate::geometry::*;
92 pub use crate::math::*;
93 #[cfg(feature = "picking-backend")]
94 pub use crate::picking_backend::*;
95 pub use crate::pipeline::*;
96 pub use crate::plugin::context::systemparams::*;
97 pub use crate::plugin::context::*;
98 pub use crate::plugin::*;
99 #[cfg(any(feature = "debug-render-3d", feature = "debug-render-2d"))]
100 pub use crate::render::*;
101}