#

API Docs for: 0.6.1
Show: Inherited Protected Private Deprecated

# DistanceConstraint Class

Extends Constraint
Defined in: `src/constraints/DistanceConstraint.js:6`

Constrains two bodies to be at a constant distance from each others center of mass.

## Constructor

### `DistanceConstraint`

(

- `bodyA`
- `bodyB`
- `[distance]`
- `[maxForce=1e6]`

)

Defined in `src/constraints/DistanceConstraint.js:6`

#### Parameters:

- `bodyA` Body
- `bodyB` Body
- `[distance]` Number optional

  The distance to keep. If undefined, it will be set to the current distance between bodyA and bodyB

- `[maxForce=1e6]` Number optional

- Index
- Methods
- Properties

## Item Index

### Methods

- disable
- enable
- update

### Properties

- bodyA
- bodyB
- collideConnected
- distance
- distanceEquation
- equations
- id

## Methods

### `disable`

()

Inherited from Constraint: `src/constraints/Constraint.js:80`

Disables all equations in the constraint.

### `enable`

()

Inherited from Constraint: `src/constraints/Constraint.js:69`

Enables all equations in the constraint.

### `update`

()

Inherited from Constraint: `src/constraints/Constraint.js:61`

Update all the equations with data.

## Properties

### `bodyA`

Body

Inherited from Constraint: `src/constraints/Constraint.js:29`

### `bodyB`

Body

Inherited from Constraint: `src/constraints/Constraint.js:34`

### `collideConnected`

Boolean

Inherited from Constraint: `src/constraints/Constraint.js:44`

Set to true if you want the bodies to collide when they are connected.

### `distance`

Number

Defined in `src/constraints/DistanceConstraint.js:28`

### `distanceEquation`

ContactEquation

Defined in `src/constraints/DistanceConstraint.js:33`

### `equations`

Array

Inherited from Constraint: `src/constraints/Constraint.js:22`

Equations to be solved in this constraint

### `id`

Number

Inherited from Constraint: `src/constraints/Constraint.js:39`