# ContactPoint

Class · category: Physics

Source: https://github.com/playcanvas/engine/blob/970d89f6d3bc6667f4e1f88153abd6e7e82ed52c/src/framework/components/rigid-body/contact-point.js#L38

Represents a single point of contact between two colliding rigid bodies in the physics
simulation. Each contact point stores detailed spatial information about the collision,
including both local and world space coordinates of the exact contact points on both entities,
the contact normal direction, and the collision impulse force.

Contact points are generated by the physics engine during collision detection and are typically
accessed through a [ContactResult](https://api.playcanvas.com/engine/classes/ContactResult.md) object, which can contain multiple contact points for a
single collision between two entities. Multiple contact points commonly occur when objects
collide along edges or faces rather than at a single point.

The impulse property can be particularly useful for gameplay mechanics that need to respond
differently based on the force of impact, such as damage calculations or sound effect volume.

Contact points are pooled and reused by the physics system, so a contact point and its vectors
are only valid inside the event handler that receives them. Copy any values that are needed
later, for example with [Vec3#clone](https://api.playcanvas.com/engine/classes/Vec3.md#clone).

**Example**

```ts
// Access contact points from a collision event
entity.collision.on('contact', (result) => {
    // Get the first contact point
    const contact = result.contacts[0];

    // Get the contact position in world space
    const worldPos = contact.point;

    // Check how hard the collision was
    if (contact.impulse > 10) {
        console.log("That was a hard impact!");
    }
});
```

## Properties

### impulse

```ts
impulse: number
```

The total accumulated impulse applied by the constraint solver during the last sub-step.
This value represents how hard two objects collided. Higher values indicate stronger impacts.

### localPoint

```ts
localPoint: Vec3
```

The point on the entity where the contact occurred, in the local space of its rigid body.
That space has the entity's world position and rotation, with any
[CollisionComponent#linearOffset](https://api.playcanvas.com/engine/classes/CollisionComponent.md#linearoffset) and [CollisionComponent#angularOffset](https://api.playcanvas.com/engine/classes/CollisionComponent.md#angularoffset)
applied, and ignores the entity's scale.

### localPointOther

```ts
localPointOther: Vec3
```

The point on the other entity where the contact occurred, in the local space of the other
entity's rigid body (see [ContactPoint#localPoint](https://api.playcanvas.com/engine/classes/ContactPoint.md#localpoint)).

### normal

```ts
normal: Vec3
```

The normal vector of the contact on the other entity, in world space. This vector points
away from the surface of the other entity at the point of contact.

### point

```ts
point: Vec3
```

The point on the entity where the contact occurred, in world space.

### pointOther

```ts
pointOther: Vec3
```

The point on the other entity where the contact occurred, in world space.
