API Docs for: 0.7.1
Show:

# LockConstraint Class

Extends Constraint

Locks the relative position and rotation between two bodies.

## Constructor

### `LockConstraint`

(
• `bodyA`
• `bodyB`
• `[options]`
)

#### Parameters:

• `bodyA` Body
• `bodyB` Body
• `[options]` Object optional
• `[localOffsetB]` Array optional

The offset of bodyB in bodyA's frame. If not given the offset is computed from current positions.

• `[localAngleB]` Number optional

The angle of bodyB in bodyA's frame. If not given, the angle is computed from current angles.

• `[maxForce]` Number optional

#### Example:

``````// Locks the relative position and rotation between bodyA and bodyB
var constraint = new LockConstraint(bodyA, bodyB);
``````

## Methods

### `getMaxForce`

() Number

Get the max force.

Number:

### `setMaxForce`

(
• `force`
)

Set the maximum force to be applied.

#### Parameters:

• `force` Number

### `setRelaxation`

(
• `relaxation`
)

Set relaxation for this constraint.

#### Parameters:

• `relaxation` Number

### `setStiffness`

(
• `stiffness`
)

Set stiffness for this constraint.

#### Parameters:

• `stiffness` Number

### `update`

()

Updates the internal constraint parameters before solve.

## Properties

### `bodyA`

Body

First body participating in the constraint.

### `bodyB`

Body

Second body participating in the constraint.

### `collideConnected`

Boolean

Set to true if you want the connected bodies to collide.

Default: true

### `equations`

Array

Equations to be solved in this constraint

### `localAngleB`

Number

The offset angle of bodyB in bodyA's frame.

### `localOffsetB`

Array

The offset of bodyB in bodyA's frame.

### `type`

Number

The type of constraint. May be one of Constraint.DISTANCE, Constraint.GEAR, Constraint.LOCK, Constraint.PRISMATIC or Constraint.REVOLUTE.