diff --git a/core/src/ext.rs b/core/src/ext.rs index 89863507..eac7d852 100644 --- a/core/src/ext.rs +++ b/core/src/ext.rs @@ -7,11 +7,11 @@ use bevy::ecs::{Schedule, System}; /// Extensions for the app builder pub trait AppBuilderExt { - /// Add a system to the "physics update" stage, so that it runs before each physics step. + /// Add a system to the "physics update" stage so that it runs before each physics step. /// /// This can be used to add systems that modify transform/velocity or other physics components. - /// - /// Typically (and by default) the physics step run at a fixed rate and are out of sync of the bevy update. + /// + /// Typically (and by default) physics steps run at a fixed rate and are out of sync with the bevy update. fn add_physics_system>(&mut self, system: S) -> &mut Self; } diff --git a/core/src/lib.rs b/core/src/lib.rs index 3d5f940e..7b5c6f36 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -17,9 +17,9 @@ mod velocity; /// Physics stages for user systems. These stages are executed once per physics step. /// -/// That usually means they don't run each frame, and may run more than once in a single frame. +/// That usually means they don't run each frame and may run more than once in a single frame. /// -/// In general end-users shouldn't have to deal with these stages directly. +/// In general, end-users shouldn't have to deal with these stages directly. /// /// Instead, it is possible to call the [`add_physiscs_system`](ext::AppBuilderExt::add_physics_system) extension function on `AppBuilder` /// to register systems that should run during the physics update. @@ -37,7 +37,7 @@ pub mod stage { pub const UPDATE: &str = "heron-before-step"; } -/// Plugin that register stage resources and components. +/// Plugin that registers stage resources and components. /// /// It does **NOT** enable physics behavior. #[derive(Debug, Copy, Clone)] @@ -153,7 +153,7 @@ impl Default for Body { pub enum BodyType { /// A dynamic body is normally affected by physic forces and affect the other bodies normally too. /// - /// This is the most "natural" type in the sense that, in the real life, everything is dynamic. + /// This is the most "natural" type in the sense that, in real life, everything is dynamic. /// /// It is the default type. Dynamic, @@ -167,22 +167,22 @@ pub enum BodyType { /// A kinematic body is not moved by the physics engine. But it can have user-defined velocity. /// - /// It affects the other bodies normally, but is not affected by them. + /// It affects the other bodies normally but is not affected by them. /// /// If the transform is updated, then a velocity will be automatically calculated, producing /// realistic interaction with other bodies. /// /// It can also have a velocity be applied. /// - /// It is well suited fo moving-platforms. + /// It is well-suited for moving platforms. Kinematic, /// A sensor is not affected by physics forces and doesn't affect other bodies either. /// - /// Other bodies will be able to penetrate the sensor. But it still participate in collision events. + /// Other bodies will be able to penetrate the sensor. But it still participates in collision events. /// /// A sensor is useful when we are only interested in collision events. - /// One may for example add a sensor to detect when the player reach a certain area. + /// One may, for example, add a sensor to detect when the player reaches a certain area. Sensor, } @@ -245,14 +245,14 @@ pub enum CollisionEvent { /// ``` #[derive(Debug, Copy, Clone, PartialEq, Reflect)] pub struct PhysicMaterial { - /// Coefficient of restitution. Affect how much it "bounces" when colliding other objects. + /// Coefficient of restitution. Affect how much it "bounces" when colliding with other objects. /// /// The higher the value, the more "bouncy". /// /// Typical values are between 0 (perfectly inelastic) and 1 (perfectly elastic) pub restitution: f32, - /// Density. Affects how much the body resist to forces. + /// Density. It affects how much the body resists forces. /// /// The higher the value, the heavier. /// diff --git a/core/src/velocity.rs b/core/src/velocity.rs index 839c2803..c9159c94 100644 --- a/core/src/velocity.rs +++ b/core/src/velocity.rs @@ -7,7 +7,7 @@ use std::ops::{Mul, MulAssign}; /// Component that defines the linear and angular velocity. /// /// The linear part is in "unit" per second on each axis, represented as a `Vec3`. (The unit, being your game unit, be it pixel or anything else) -/// The angular part is in radians per second around an axis, represented as a `Quat` +/// The angular part is in radians per second around an axis, represented as a `Quat`. /// /// # Example /// diff --git a/rapier/src/lib.rs b/rapier/src/lib.rs index 10e8352a..a9cc1412 100644 --- a/rapier/src/lib.rs +++ b/rapier/src/lib.rs @@ -50,7 +50,7 @@ pub struct RapierPlugin { pub parameters: IntegrationParameters, } -/// Components automatically register, by the plugin that references the body in rapier's world +/// Components automatically register, by the plugin that references the body in rapier's world. /// /// It can be used to get direct access to rapier's world. #[derive(Debug, Copy, Clone)] @@ -60,11 +60,11 @@ pub struct BodyHandle { } impl RapierPlugin { - /// Configure how many times per second the physics world needs to be updated + /// Configure how many times per second the physics world needs to be updated. /// /// # Panics /// - /// Panic if the number of `steps_per_second` is 0 + /// Panic if the number of `steps_per_second` is 0. pub fn from_steps_per_second(steps_per_second: u8) -> Self { assert!( steps_per_second > 0, @@ -146,7 +146,7 @@ impl Plugin for RapierPlugin { } impl BodyHandle { - /// Creates the new `BodyHandle` + /// Creates the new `BodyHandle`. #[must_use] pub fn new(rigid_body: RigidBodyHandle, collider: ColliderHandle) -> BodyHandle { BodyHandle { @@ -155,13 +155,13 @@ impl BodyHandle { } } - /// Returns the rapier's rigid body handle + /// Returns the rapier's rigid body handle. #[must_use] pub fn rigid_body(&self) -> RigidBodyHandle { self.rigid_body } - /// Returns the rapier's collider handle + /// Returns the rapier's collider handle. #[must_use] pub fn collider(&self) -> ColliderHandle { self.collider diff --git a/src/lib.rs b/src/lib.rs index f0462706..1d1e797f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -24,11 +24,11 @@ //! heron = { version = "0.2.0", default-features = false, features = ["2d"] } //! ``` //! -//! Note: when debugging you may consider enabling the `debug` feature, to render the collision shapes (works only for 2d, at the moment). +//! Note: when debugging, you may consider enabling the `debug` feature to render the collision shapes (works only for 2d, at the moment). //! //! ## Install the plugin //! -//! To enable physics and collision detection, the [`PhysicsPlugin`] should be installed +//! The [`PhysicsPlugin`] should be installed to enable physics and collision detection. //! //! ```no_run //! use bevy::prelude::*; @@ -48,7 +48,7 @@ //! To create a rigid body, add the component `Body` to the entity, choosing a collision shape. //! It will turn the entity into a dynamic rigid body affected by physics. //! -//! The position, and rotation is defined by the bevy `GlobalTransform` component. +//! The position and rotation are defined by the bevy `GlobalTransform` component. //! //! ``` //! # use bevy::prelude::*; @@ -72,10 +72,10 @@ //! //! ## Run systems synchronously with the physics step //! -//! The physics step runs at fixed rate (60 times per second by default) and is out of sync of the +//! The physics step runs at a fixed rate (60 times per second by default) and is out of sync of the //! bevy frame. //! -//! But modifying any physics component (such as the transform or velocity) **must** be done synchronously with +//! But modifying any physics component (such as the transform or velocity), **must** be done synchronously with //! the physics step. //! //! The simplest way is to add these systems with `add_physics_system`: @@ -99,18 +99,18 @@ //! # fn update_velocities() {} //! ``` //! -//! ## Move rigid bodies programatically +//! ## Move rigid bodies programmatically //! -//! When creating games, it is often useful to interact with the physics engine and move bodies programatically. +//! When creating games, it is often useful to interact with the physics engine and move bodies programmatically. //! For this, you have two options: Updating the `Transform` or applying a [`Velocity`]. //! //! ### Option 1: Update the Transform //! -//! For kinematic bodies ([`BodyType::Kinematic`]), if the transform is udpated, +//! For kinematic bodies ([`BodyType::Kinematic`]), if the transform is updated, //! the body is moved and get an automatically calculated velocity. Physics rules will be applied normally. //! Updating the transform is a good way to move a kinematic body. //! -//! For other type of bodies, if the transform is updated, +//! For other types of bodies, if the transform is updated, //! the rigid body will be *teleported* to the new position/rotation, **ignoring physic rules**. //! //! ### Option 2: Use the Velocity component @@ -137,7 +137,7 @@ use heron_rapier::RapierPlugin; /// Physics behavior powered by [rapier](https://rapier.rs) /// -/// Allow to access the underlying physics world directly +/// Allow access to the underlying physics world directly pub mod rapier_plugin { pub use heron_rapier::*; } @@ -150,7 +150,7 @@ pub mod prelude { }; } -/// Plugin to install in order to enable collision detection and physics behavior. +/// Plugin to install to enable collision detection and physics behavior. /// /// When creating the plugin, you may choose the number of physics steps per second. /// For more advanced configuration, you can create the plugin from a rapier `IntegrationParameters` definition.