Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak disabling docs #585

Merged
merged 1 commit into from
Dec 9, 2024
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/collision/collider/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ pub trait ScalableCollider: AnyCollider {
/// and should not detect collisions or be included in spatial queries.
///
/// This is useful for temporarily disabling a collider without removing it from the world.
/// To re-enable the collider, simply remove the component.
/// To re-enable the collider, simply remove this component.
///
/// Note that a disabled collider will still contribute to the mass properties of the rigid body
/// it is attached to. Set the [`Mass`] of the collider to zero to prevent this.
Expand Down Expand Up @@ -145,10 +145,10 @@ pub trait ScalableCollider: AnyCollider {
/// }
/// }
/// ```
#[derive(Reflect, Clone, Copy, Component, Debug, Default, PartialEq, Eq, From)]
#[derive(Reflect, Clone, Copy, Component, Debug, Default)]
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serialize", reflect(Serialize, Deserialize))]
#[reflect(Debug, Component, Default, PartialEq)]
#[reflect(Debug, Component, Default)]
pub struct ColliderDisabled;

/// A component that stores the `Entity` ID of the [`RigidBody`] that a [`Collider`] is attached to.
Expand Down
10 changes: 5 additions & 5 deletions src/dynamics/rigid_body/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ pub(crate) type RigidBodyActiveFilter = (Without<RigidBodyDisabled>, Without<Sle
/// and attached joints.
///
/// This is useful for temporarily disabling a body without removing it from the world.
/// To re-enable the body, simply remove the component.
/// To re-enable the body, simply remove this component.
///
/// Note that this component does *not* disable collision detection or spatial queries for colliders
/// attached to the rigid body.
Expand Down Expand Up @@ -349,10 +349,10 @@ pub(crate) type RigidBodyActiveFilter = (Without<RigidBodyDisabled>, Without<Sle
/// }
/// }
/// ```
#[derive(Reflect, Clone, Copy, Component, Debug, Default, PartialEq, Eq, From)]
#[derive(Reflect, Clone, Copy, Component, Debug, Default)]
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serialize", reflect(Serialize, Deserialize))]
#[reflect(Debug, Component, Default, PartialEq)]
#[reflect(Debug, Component, Default)]
pub struct RigidBodyDisabled;

/// Indicates that a [rigid body](RigidBody) is not simulated by the physics engine until woken up again.
Expand All @@ -365,10 +365,10 @@ pub struct RigidBodyDisabled;
///
/// Sleeping can be disabled for specific entities with the [`SleepingDisabled`] component,
/// or for all entities by setting the [`SleepingThreshold`] to a negative value.
#[derive(Reflect, Clone, Copy, Component, Debug, Default, PartialEq, Eq, From)]
#[derive(Reflect, Clone, Copy, Component, Debug, Default)]
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serialize", reflect(Serialize, Deserialize))]
#[reflect(Debug, Component, Default, PartialEq)]
#[reflect(Debug, Component, Default)]
pub struct Sleeping;

/// How long the velocity of the body has been below the [`SleepingThreshold`],
Expand Down
14 changes: 11 additions & 3 deletions src/dynamics/solver/joints/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,17 @@ impl AngleLimit {
}
}

/// Disables the joint of the entity it is placed on.
#[derive(Reflect, Clone, Copy, Component, Debug)]
/// A marker component that indicates that a [joint](self) is disabled
/// and should not constrain the bodies it is attached to.
/// Must be on the same entity as the joint.
///
/// This is useful for temporarily disabling a joint without removing it from the world.
/// To re-enable the joint, simply remove this component.
///
/// Note that when re-enabling the joint, the bodies may snap back violently
/// if they have moved significantly from the constrained positions while the joint was disabled.
#[derive(Reflect, Clone, Copy, Component, Debug, Default)]
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serialize", reflect(Serialize, Deserialize))]
#[reflect(Debug, Component)]
#[reflect(Debug, Component, Default)]
pub struct JointDisabled;
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@
//! - [Prismatic joint](PrismaticJoint)
//! - [Revolute joint](RevoluteJoint)
#![cfg_attr(feature = "3d", doc = " - [Spherical joint](SphericalJoint)")]
//! - [Temporarily disabling a joint](JointDisabled)
//! - [Custom XPBD constraints](dynamics::solver::xpbd#constraints) (advanced)
//!
//! Joint motors and articulations are not supported yet, but they will be implemented in a future release.
Expand Down
Loading