#

API Docs for: 0.6.1
Show: Inherited Protected Private Deprecated

# PointToPointConstraint Class

Extends Constraint
Defined in: `src/constraints/PointToPointConstraint.js:7`

Connects two bodies at given offset points.

## Constructor

### `PointToPointConstraint`

(

- `bodyA`
- `pivotA`
- `bodyB`
- `pivotB`
- `maxForce`

)

Defined in `src/constraints/PointToPointConstraint.js:7`

#### 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);
            bodyA.addShape(shapeA);
            bodyB.addShape(shapeB);
            world.addBody(bodyA);
            world.addBody(bodyB);
            var localPivotA = new Vec3(1, 0, 0);
            var localPivotB = new Vec3(-1, 0, 0);
            var constraint = new PointToPointConstraint(bodyA, localPivotA, bodyB, localPivotB);
            world.addConstraint(constraint);

- Index
- Methods
- Properties

## Item Index

### Methods

- disable
- enable
- update

### Properties

- bodyA
- bodyB
- collideConnected
- equations
- equationX
- equationY
- equationZ
- id
- pivotA
- pivotB

## 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.

### `equations`

Array

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

Equations to be solved in this constraint

### `equationX`

ContactEquation

Defined in `src/constraints/PointToPointConstraint.js:49`

### `equationY`

ContactEquation

Defined in `src/constraints/PointToPointConstraint.js:54`

### `equationZ`

ContactEquation

Defined in `src/constraints/PointToPointConstraint.js:59`

### `id`

Number

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

### `pivotA`

Vec3

Defined in `src/constraints/PointToPointConstraint.js:37`

Pivot, defined locally in bodyA.

### `pivotB`

Vec3

Defined in `src/constraints/PointToPointConstraint.js:43`

Pivot, defined locally in bodyB.