# Class ConvexPolyhedron

A shape that is a convex polygon.

## Constructors

• Creates a new convex polygon shape.

#### Parameters

• ##### vertices: Float32Array

The coordinates of the convex polygon's vertices.

• ##### `Optional` indices: Uint32Array

The index buffer of this convex mesh. If this is `null` or `undefined`, the convex-hull of the input vertices will be computed automatically. Otherwise, it will be assumed that the mesh you provide is already convex.

## Properties

indices?: Uint32Array

The indices of the convex polygon.

type: ConvexPolyhedron = ShapeType.ConvexPolyhedron
vertices: Float32Array

The vertices of the convex polygon.

## Methods

#### Returns RayIntersection

• Computes the time of impact between two moving shapes.

### Returns

If the two moving shapes collider at some point along their trajectories, this returns the time at which the two shape collider as well as the contact information during the impact. Returns `null`if the two shapes never collide along their paths.

#### Parameters

• ##### shapePos1: Vector

The initial position of this sahpe.

• ##### shapeRot1: Rotation

The rotation of this shape.

• ##### shapeVel1: Vector

The velocity of this shape.

• ##### shape2: Shape

The second moving shape.

• ##### shapePos2: Vector

The initial position of the second shape.

• ##### shapeRot2: Rotation

The rotation of the second shape.

• ##### shapeVel2: Vector

The velocity of the second shape.

• ##### maxToi: number

The maximum time when the impact can happen.

• ##### stopAtPenetration: boolean

If set to `false`, the linear shape-cast won’t immediately stop if the shape is penetrating another shape at its starting point and its trajectory is such that it’s on a path to exist that penetration state.

#### Returns ShapeTOI

• Computes one pair of contact points between two shapes.

### Returns

`null` if the shapes are separated by a distance greater than prediction, otherwise contact details. The result is given in world-space.

#### Parameters

• ##### shapePos1: Vector

The initial position of this sahpe.

• ##### shapeRot1: Rotation

The rotation of this shape.

• ##### shape2: Shape

The second shape.

• ##### shapePos2: Vector

The initial position of the second shape.

• ##### shapeRot2: Rotation

The rotation of the second shape.

• ##### prediction: number

The prediction value, if the shapes are separated by a distance greater than this value, test will fail.

#### Returns boolean

• Tests if this shape intersects another shape.

### Returns

`true` if the two shapes intersect, `false` if they don’t.

#### Parameters

• ##### shapePos1: Vector

The position of this shape.

• ##### shapeRot1: Rotation

The rotation of this shape.

• ##### shape2: Shape

The second shape to test.

• ##### shapePos2: Vector

The position of the second shape.

• ##### shapeRot2: Rotation

The rotation of the second shape.

#### Returns PointProjection

• instant mode without cache

#### Returns Shape

Generated using TypeDoc