From 5c742cc50a66a7b430d7a04d510099e0d3bcf2ff Mon Sep 17 00:00:00 2001 From: ghostly_zsh Date: Thu, 20 Nov 2025 17:03:16 -0600 Subject: [PATCH] feat: springy joints --- crates/unified/src/server/player.rs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/crates/unified/src/server/player.rs b/crates/unified/src/server/player.rs index 04fe2ea0348c19be9f2bf2e81163a87936f2553a..d13315e223ad025c031895fc2e537758f6872321 100644 --- a/crates/unified/src/server/player.rs +++ b/crates/unified/src/server/player.rs @@ -344,12 +344,21 @@ fn dragging( ); // create the joint... - let joint = FixedJoint::new(target_part.2, source_part.2) + let joint = PrismaticJoint::new(target_part.2, source_part.2) + .with_slider_axis(source_joint.2.translation.xy().normalize()) .with_local_anchor1(target_joint.2.translation.xy()) .with_local_basis1(target_joint.0.transform.rotation.to_euler(EulerRot::ZYX).0 + PI - - source_joint.0.transform.rotation.to_euler(EulerRot::ZYX).0); + - source_joint.0.transform.rotation.to_euler(EulerRot::ZYX).0) + .with_limits(0.0, 0.0) + .with_align_compliance(0.0002) + .with_angle_compliance(0.00000002) + .with_limit_compliance(0.006); + let joint_damping = JointDamping { + linear: 4.0, + angular: 0.1, + }; - let joint_id = commands.spawn(joint).id(); + let joint_id = commands.spawn((joint, joint_damping)).id(); // create the peering component... commands.entity(source_joint.4).insert(Peer { @@ -418,4 +427,4 @@ fn magic_fuel_regen(players: Query<&mut PlayerStorage, With>, time: Res< for mut storage in players { storage.fuel = (storage.fuel + 5.0 * time.delta_secs()).min(storage.fuel_capacity); } -} \ No newline at end of file +}