Skip to content

Commit

Permalink
Make disabling joints possible. (#519)
Browse files Browse the repository at this point in the history
  • Loading branch information
shanecelis authored Sep 26, 2024
1 parent d79bb13 commit 68e2ba7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/dynamics/solver/joints/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,3 +338,10 @@ impl AngleLimit {
None
}
}

/// Disables the joint of the entity it is placed on.
#[derive(Reflect, Clone, Copy, Component, Debug)]
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serialize", reflect(Serialize, Deserialize))]
#[reflect(Debug, Component)]
pub struct JointDisabled;
2 changes: 1 addition & 1 deletion src/dynamics/solver/xpbd/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ pub trait XpbdConstraint<const ENTITY_COUNT: usize>: MapEntities {
pub fn solve_constraint<C: XpbdConstraint<ENTITY_COUNT> + Component, const ENTITY_COUNT: usize>(
mut commands: Commands,
mut bodies: Query<RigidBodyQuery>,
mut constraints: Query<&mut C, Without<RigidBody>>,
mut constraints: Query<&mut C, (Without<RigidBody>, Without<JointDisabled>)>,
time: Res<Time>,
) {
let delta_secs = time.delta_seconds_adjusted();
Expand Down

0 comments on commit 68e2ba7

Please sign in to comment.