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}
38
39/// Type aliases to select the right vector/rotation types based
40/// on the dimension used by the engine.
41#[cfg(feature = "dim3")]
42pub mod math {
43    use bevy::math::{Quat, Vec3};
44    /// The real type (f32 or f64).
45    pub type Real = rapier::math::Real;
46    /// The vector type.
47    pub type Vect = Vec3;
48    /// The integer vector type.
49    pub type IVect = bevy::math::IVec3;
50    /// The rotation type.
51    pub type Rot = Quat;
52}
53
54/// Components related to physics dynamics (rigid-bodies, velocities, etc.)
55pub mod dynamics;
56/// Components related to physics geometry (colliders, collision-groups, etc.)
57pub mod geometry;
58/// Components and resources related to the physics simulation workflow (events, hooks, etc.)
59pub mod pipeline;
60/// The physics plugin and systems.
61pub mod plugin;
62
63/// Reflection utilities.
64pub mod reflect;
65
66#[cfg(feature = "picking-backend")]
67pub mod picking_backend;
68
69/// Components related to character control.
70pub mod control;
71/// The debug-renderer.
72#[cfg(any(feature = "debug-render-3d", feature = "debug-render-2d"))]
73pub mod render;
74/// Miscellaneous helper functions.
75pub mod utils;
76
77/// Groups the most often used types.
78pub mod prelude {
79    pub use crate::control::*;
80    pub use crate::dynamics::*;
81    pub use crate::geometry::*;
82    pub use crate::math::*;
83    #[cfg(feature = "picking-backend")]
84    pub use crate::picking_backend::*;
85    pub use crate::pipeline::*;
86    pub use crate::plugin::context::systemparams::*;
87    pub use crate::plugin::context::*;
88    pub use crate::plugin::*;
89    #[cfg(any(feature = "debug-render-3d", feature = "debug-render-2d"))]
90    pub use crate::render::*;
91}