C# Class FarseerPhysics.Dynamics.Joints.DistanceJoint

A distance joint rains two points on two bodies to remain at a fixed distance from each other. You can view this as a massless, rigid rod.
Inheritance: Joint
Mostra file Open project: prime31/Nez Class Usage Examples

Public Properties

Property Type Description
dampingRatio float
frequency float
length float
localAnchorA Vector2
localAnchorB Vector2

Public Methods

Method Description
DistanceJoint ( Body bodyA, Body bodyB, Vector2 anchorA, Vector2 anchorB, bool useWorldCoordinates = false ) : System

This requires defining an anchor point on both bodies and the non-zero length of the distance joint. If you don't supply a length, the local anchor points is used so that the initial configuration can violate the constraint slightly. This helps when saving and loading a game. Warning Do not use a zero or short length.

getReactionForce ( float invDt ) : Vector2

Get the reaction force given the inverse time step. Unit is N.

getReactionTorque ( float invDt ) : float

Get the reaction torque given the inverse time step. Unit is N*m. This is always zero for a distance joint.

Private Methods

Method Description
DistanceJoint ( ) : System
initVelocityConstraints ( SolverData &data ) : void
solvePositionConstraints ( SolverData &data ) : bool
solveVelocityConstraints ( SolverData &data ) : void

Method Details

DistanceJoint() public method

This requires defining an anchor point on both bodies and the non-zero length of the distance joint. If you don't supply a length, the local anchor points is used so that the initial configuration can violate the constraint slightly. This helps when saving and loading a game. Warning Do not use a zero or short length.
public DistanceJoint ( Body bodyA, Body bodyB, Vector2 anchorA, Vector2 anchorB, bool useWorldCoordinates = false ) : System
bodyA Body The first body
bodyB Body The second body
anchorA Vector2 The first body anchor
anchorB Vector2 The second body anchor
useWorldCoordinates bool Set to true if you are using world coordinates as anchors.
return System

getReactionForce() public method

Get the reaction force given the inverse time step. Unit is N.
public getReactionForce ( float invDt ) : Vector2
invDt float
return Vector2

getReactionTorque() public method

Get the reaction torque given the inverse time step. Unit is N*m. This is always zero for a distance joint.
public getReactionTorque ( float invDt ) : float
invDt float
return float

Property Details

dampingRatio public_oe property

The damping ratio. 0 = no damping, 1 = critical damping.
public float dampingRatio
return float

frequency public_oe property

The mass-spring-damper frequency in Hertz. A value of 0 disables softness.
public float frequency
return float

length public_oe property

The natural length between the anchor points. Manipulating the length can lead to non-physical behavior when the frequency is zero.
public float length
return float

localAnchorA public_oe property

The local anchor point relative to bodyA's origin.
public Vector2 localAnchorA
return Vector2

localAnchorB public_oe property

The local anchor point relative to bodyB's origin.
public Vector2 localAnchorB
return Vector2