DataContainer
, Shiftable
public class FrictionJoint extends Joint implements Shiftable, DataContainer
A friction joint is a constraint that drives both linear and angular velocities to zero.
This joint is typically used with one dynamic and one static body. In this context, the joint will apply linear and angular friction to stop the body's motion.
Setting the maximum force and torque values will determine the rate at which the motion is stopped.
Constructor | Description |
---|---|
FrictionJoint(Body body1,
Body body2,
Vector2 anchor) |
Minimal constructor.
|
Modifier and Type | Method | Description |
---|---|---|
Vector2 |
getAnchor1() |
Returns the anchor point on the first
Body in
world coordinates. |
Vector2 |
getAnchor2() |
Returns the anchor point on the second
Body in
world coordinates. |
double |
getMaximumForce() |
Returns the maximum force this constraint will apply in newtons.
|
double |
getMaximumTorque() |
Returns the maximum torque this constraint will apply in newton-meters.
|
Vector2 |
getReactionForce(double invdt) |
Returns the force applied to the
Body s in order
to satisfy the constraint in newtons. |
double |
getReactionTorque(double invdt) |
Returns the torque applied to the
Body s in order
to satisfy the constraint in newton-meters. |
void |
initializeConstraints(Step step,
Settings settings) |
Performs any initialization of the velocity and position constraints.
|
void |
setMaximumForce(double maximumForce) |
Sets the maximum force this constraint will apply in newtons.
|
void |
setMaximumTorque(double maximumTorque) |
Sets the maximum torque this constraint will apply in newton-meters.
|
void |
shift(Vector2 shift) |
Translates the object to match the given coordinate shift.
|
boolean |
solvePositionConstraints(Step step,
Settings settings) |
Solves the position constraints.
|
void |
solveVelocityConstraints(Step step,
Settings settings) |
Solves the velocity constraints.
|
java.lang.String |
toString() |
getBody1, getBody2
getUserData, setUserData
getId, getUserData, isActive, isCollisionAllowed, setCollisionAllowed, setUserData
public void initializeConstraints(Step step, Settings settings)
Joint
initializeConstraints
in class Joint
step
- the time step informationsettings
- the current world settingspublic void solveVelocityConstraints(Step step, Settings settings)
Joint
solveVelocityConstraints
in class Joint
step
- the time step informationsettings
- the current world settingspublic boolean solvePositionConstraints(Step step, Settings settings)
Joint
solvePositionConstraints
in class Joint
step
- the time step informationsettings
- the current world settingspublic Vector2 getAnchor1()
Joint
Body
in
world coordinates.getAnchor1
in class Joint
Vector2
public Vector2 getAnchor2()
Joint
Body
in
world coordinates.getAnchor2
in class Joint
Vector2
public Vector2 getReactionForce(double invdt)
Joint
Body
s in order
to satisfy the constraint in newtons.getReactionForce
in class Joint
invdt
- the inverse delta timeVector2
public double getReactionTorque(double invdt)
Joint
Body
s in order
to satisfy the constraint in newton-meters.getReactionTorque
in class Joint
invdt
- the inverse delta timepublic void shift(Vector2 shift)
Shiftable
public double getMaximumTorque()
public void setMaximumTorque(double maximumTorque)
maximumTorque
- the maximum torque in newton-meters; in the range [0, ∞]java.lang.IllegalArgumentException
- if maxTorque is less than zeropublic double getMaximumForce()
public void setMaximumForce(double maximumForce)
maximumForce
- the maximum force in newtons; in the range [0, ∞]java.lang.IllegalArgumentException
- if maxForce is less than zero