Skip to content

Commit 68e2ba7

Browse files
authored
Make disabling joints possible. (#519)
1 parent d79bb13 commit 68e2ba7

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/dynamics/solver/joints/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,3 +338,10 @@ impl AngleLimit {
338338
None
339339
}
340340
}
341+
342+
/// Disables the joint of the entity it is placed on.
343+
#[derive(Reflect, Clone, Copy, Component, Debug)]
344+
#[cfg_attr(feature = "serialize", derive(serde::Serialize, serde::Deserialize))]
345+
#[cfg_attr(feature = "serialize", reflect(Serialize, Deserialize))]
346+
#[reflect(Debug, Component)]
347+
pub struct JointDisabled;

src/dynamics/solver/xpbd/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ pub trait XpbdConstraint<const ENTITY_COUNT: usize>: MapEntities {
351351
pub fn solve_constraint<C: XpbdConstraint<ENTITY_COUNT> + Component, const ENTITY_COUNT: usize>(
352352
mut commands: Commands,
353353
mut bodies: Query<RigidBodyQuery>,
354-
mut constraints: Query<&mut C, Without<RigidBody>>,
354+
mut constraints: Query<&mut C, (Without<RigidBody>, Without<JointDisabled>)>,
355355
time: Res<Time>,
356356
) {
357357
let delta_secs = time.delta_seconds_adjusted();

0 commit comments

Comments
 (0)