Skip to content

Commit

Permalink
Added default friction values to the FrictionJoint to help with
Browse files Browse the repository at this point in the history
beginners using the constraint
  • Loading branch information
wnbittle committed Mar 4, 2020
1 parent 700d33a commit 8d4c7a6
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/main/java/org/dyn4j/dynamics/joint/FrictionJoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,13 @@
* context, the joint will apply linear and angular friction to stop the body's motion.
* <p>
* Setting the maximum force and torque values will determine the rate at which the motion
* is stopped.
* is stopped. These values are defaulted to 10 and 0.25 respectively.
* <p>
* NOTE: In versions 3.4.0 and below, the maximum force and torque values were 0 by default.
* This was changed in 3.4.1 to allow users to better understand the use of this joint
* when first using it.
* @author William Bittle
* @version 3.2.0
* @version 3.4.1
* @since 1.0.0
* @see <a href="http:https://www.dyn4j.org/documentation/joints/#Friction_Joint" target="_blank">Documentation</a>
*/
Expand Down Expand Up @@ -104,6 +108,11 @@ public FrictionJoint(Body body1, Body body2, Vector2 anchor) {
this.K = new Matrix22();
this.linearImpulse = new Vector2();
this.angularImpulse = 0.0;

// the maximum force in Newtons
this.maximumForce = 10;
// the maximum torque in Newton-Meters
this.maximumTorque = 0.25;
}

/* (non-Javadoc)
Expand Down

0 comments on commit 8d4c7a6

Please sign in to comment.