API Docs for: 0.6.1
Show:

# PointToPointConstraint Class

Extends Constraint

Connects two bodies at given offset points.

## Constructor

### `PointToPointConstraint`

(
• `bodyA`
• `pivotA`
• `bodyB`
• `pivotB`
• `maxForce`
)

#### Parameters:

• `bodyA` Body
• `pivotA` Vec3

The point relative to the center of mass of bodyA which bodyA is constrained to.

• `bodyB` Body

Body that will be constrained in a similar way to the same point as bodyA. We will therefore get a link between bodyA and bodyB. If not specified, bodyA will be constrained to a static point.

• `pivotB` Vec3

See pivotA.

• `maxForce` Number

The maximum force that should be applied to constrain the bodies.

#### Example:

``````var bodyA = new Body({ mass: 1 });
var bodyB = new Body({ mass: 1 });
bodyA.position.set(-1, 0, 0);
bodyB.position.set(1, 0, 0);
var localPivotA = new Vec3(1, 0, 0);
var localPivotB = new Vec3(-1, 0, 0);
var constraint = new PointToPointConstraint(bodyA, localPivotA, bodyB, localPivotB);
``````

## Methods

### `disable`

()

Disables all equations in the constraint.

### `enable`

()

Enables all equations in the constraint.

### `update`

()

Update all the equations with data.

## Properties

Body

Body

### `collideConnected`

Boolean

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

### `equations`

Array

Equations to be solved in this constraint

ContactEquation

ContactEquation

ContactEquation

Number

### `pivotA`

Vec3

Pivot, defined locally in bodyA.

### `pivotB`

Vec3

Pivot, defined locally in bodyB.