APIdia Launch Partner
Top Description Fields Constructors Methods
com.badlogic.gdx.physics.box2d.joints

public Class DistanceJointDef

extends JointDef
Class Inheritance
Imports
com.badlogic.gdx.math.Vector2, com.badlogic.gdx.physics.box2d.Body, .JointDef

Distance joint definition. This requires defining an anchor point on both bodies and the non-zero length of the distance joint. The definition uses local anchor points so that the initial configuration can violate the constraint slightly. This helps when saving and loading a game.

Field Summary

Modifier and TypeField and Description
public float
dampingRatio

The damping ratio.

public float
frequencyHz

The mass-spring-damper frequency in Hertz.

public float
length

The natural length between the anchor points.

public final Vector2
localAnchorA

The local anchor point relative to body1's origin.

public final Vector2
localAnchorB

The local anchor point relative to body2's origin.

Inherited from com.badlogic.gdx.physics.box2d.JointDef:
bodyAbodyBcollideConnectedtype

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
initialize(Body bodyA, Body bodyB, Vector2 anchorA, Vector2 anchorB)

Initialize the bodies, anchors, and length using the world anchors.

Field Detail

dampingRatioback to summary
public float dampingRatio

The damping ratio. 0 = no damping, 1 = critical damping.

frequencyHzback to summary
public float frequencyHz

The mass-spring-damper frequency in Hertz.

lengthback to summary
public float length

The natural length between the anchor points.

localAnchorAback to summary
public final Vector2 localAnchorA

The local anchor point relative to body1's origin.

localAnchorBback to summary
public final Vector2 localAnchorB

The local anchor point relative to body2's origin.

Constructor Detail

DistanceJointDefback to summary
public DistanceJointDef()

Method Detail

initializeback to summary
public void initialize(Body bodyA, Body bodyB, Vector2 anchorA, Vector2 anchorB)

Initialize the bodies, anchors, and length using the world anchors.