DistanceJointDef

data class DistanceJointDef(val bodyA: Body, val bodyB: Body, val localAnchorA: Vec2 = Vec2.Zero, val localAnchorB: Vec2 = Vec2.Zero, val length: Float = 1.0f, val enableSpring: Boolean = false, val hertz: Float = 0.0f, val dampingRatio: Float = 0.0f, val enableLimit: Boolean = false, val minLength: Float = 0.0f, val maxLength: Float = B2_HUGE, val enableMotor: Boolean = false, val maxMotorForce: Float = 0.0f, val motorSpeed: Float = 0.0f, val collideConnected: Boolean = false)

Distance joint definition.

A distance joint constrains two points on two bodies to remain at a fixed distance from each other. You can view this as a massless, rigid rod.

Parameters

bodyA

The first attached body

bodyB

The second attached body

localAnchorA

The local anchor point relative to bodyA's origin

localAnchorB

The local anchor point relative to bodyB's origin

length

The rest length of this joint (distance between anchors). Clamped to a stable minimum value.

Constructors

Link copied to clipboard
constructor(bodyA: Body, bodyB: Body, localAnchorA: Vec2 = Vec2.Zero, localAnchorB: Vec2 = Vec2.Zero, length: Float = 1.0f, enableSpring: Boolean = false, hertz: Float = 0.0f, dampingRatio: Float = 0.0f, enableLimit: Boolean = false, minLength: Float = 0.0f, maxLength: Float = B2_HUGE, enableMotor: Boolean = false, maxMotorForce: Float = 0.0f, motorSpeed: Float = 0.0f, collideConnected: Boolean = false)

Properties

Link copied to clipboard
val bodyA: Body
Link copied to clipboard
val bodyB: Body
Link copied to clipboard

Set this flag to true if the attached bodies should collide

Link copied to clipboard

The spring linear damping ratio, non-dimensional

Link copied to clipboard

Enable the joint limit

Link copied to clipboard

Enable the joint motor

Link copied to clipboard

Enable the distance constraint to behave like a spring. If false then the distance joint will be rigid, overriding the limit and motor.

Link copied to clipboard

The spring linear stiffness Hertz, cycles per second

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Maximum length. Must be greater than or equal to the minimum length.

Link copied to clipboard

The maximum motor force, usually in newtons

Link copied to clipboard

Minimum length. Clamped to a stable minimum value.

Link copied to clipboard

The desired motor speed, usually in meters per second