From cc3b0215c8439de23203983efb4f52e0b868972e Mon Sep 17 00:00:00 2001 From: Erin Catto Date: Wed, 14 Oct 2026 22:16:12 -0700 Subject: [PATCH] clean up --- src/contact_solver_wide.inl | 7 ++++--- src/joint.h | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/contact_solver_wide.inl b/src/contact_solver_wide.inl index 3e97920..1f685b3 100644 --- a/src/contact_solver_wide.inl +++ b/src/contact_solver_wide.inl @@ -1325,11 +1325,12 @@ B3_FORCE_INLINE void b3SolveContactsW( b3SolverBlock block, b3StepContext* conte b3Vec3W rA = cm->centerA; b3Vec3W rB = cm->centerB; + b3Vec3W angularRelativeVelocity = b3SubVW( b3CrossW( bB.w, rB ), b3CrossW( bA.w, rA ) ); + // Relative tangent velocity at contact - b3Vec3W vr = b3SubVW( b3CrossW( bB.w, rB ), b3CrossW( bA.w, rA ) ); b3Vec2W vt = { - b3AddW( linearTangentVelocity1, b3DotW( vr, tangent1 ) ), - b3AddW( linearTangentVelocity2, b3DotW( vr, tangent2 ) ), + b3AddW( linearTangentVelocity1, b3DotW( angularRelativeVelocity, tangent1 ) ), + b3AddW( linearTangentVelocity2, b3DotW( angularRelativeVelocity, tangent2 ) ), }; // Incremental tangent impulse diff --git a/src/joint.h b/src/joint.h index 474e82b..9a8c347 100644 --- a/src/joint.h +++ b/src/joint.h @@ -414,6 +414,7 @@ void b3DrawSphericalJoint( b3DebugDraw* draw, b3JointSim* base, b3WorldTransform void b3DrawWeldJoint( b3DebugDraw* draw, b3JointSim* base, b3WorldTransform transformA, b3WorldTransform transformB, float scale ); void b3DrawWheelJoint( b3DebugDraw* draw, b3JointSim* base, b3WorldTransform transformA, b3WorldTransform transformB, float scale ); +// K = [(1/m1 + 1/m2) * eye(2) - skew(r1) * invI1 * skew(r1) - skew(r2) * invI2 * skew(r2)] static inline b3Vec3 b3SolvePointConstraint( float mA, float mB, b3Matrix3 iA, b3Matrix3 iB, b3Vec3 rA, b3Vec3 rB, b3Vec3 rhs ) { float axy = rA.z * iA.cy.y - rA.y * iA.cz.y;