# Class Polyline

A shape that is a triangle mesh.

#### Hierarchy (view full)

- Shape
  - Polyline

- Defined in geometry/shape.d.ts:333

#####
Index

### Constructors

constructor

### Properties

indices
type
vertices

### Methods

castRay
castRayAndGetNormal
castShape
contactShape
containsPoint
intersectsRay
intersectsShape
intoRaw
projectPoint
fromRaw

## Constructors

### constructor

- new Polyline(vertices, indices?): Polyline

- Creates a new polyline shape.

  #### Parameters

  - vertices: Float32Array

    The coordinates of the polyline's vertices.

  - `Optional` indices: Uint32Array

    The indices of the polyline's segments. If this is `null` or not provided, then the vertices are assumed to form a line strip.

  #### Returns Polyline

  Overrides Shape.constructor

  - Defined in geometry/shape.d.ts:350

## Properties

### indices

indices: Uint32Array

The indices of the segments.

- Defined in geometry/shape.d.ts:342

### `Readonly` type

type: Polyline = ShapeType.Polyline

Overrides Shape.type

- Defined in geometry/shape.d.ts:334

### vertices

vertices: Float32Array

The vertices of the polyline.

- Defined in geometry/shape.d.ts:338

## Methods

### castRay

- castRay(ray, shapePos, shapeRot, maxToi, solid): number

- #### Parameters

  - ray: Ray
  - shapePos: Vector
  - shapeRot: Rotation
  - maxToi: number
  - solid: boolean

  #### Returns number

  Inherited from Shape.castRay

  - Defined in geometry/shape.d.ts:64

### castRayAndGetNormal

- castRayAndGetNormal(ray, shapePos, shapeRot, maxToi, solid): RayIntersection

- #### Parameters

  - ray: Ray
  - shapePos: Vector
  - shapeRot: Rotation
  - maxToi: number
  - solid: boolean

  #### Returns RayIntersection

  Inherited from Shape.castRayAndGetNormal

  - Defined in geometry/shape.d.ts:65

### castShape

- castShape(shapePos1, shapeRot1, shapeVel1, shape2, shapePos2, shapeRot2, shapeVel2, targetDistance, maxToi, stopAtPenetration): ShapeCastHit

- Computes the time of impact between two moving shapes.

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

  - targetDistance: number

    − If the shape moves closer to this distance from a collider, a hit will be returned.

  - 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 exit that penetration state.

  #### Returns ShapeCastHit

  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.

  Inherited from Shape.castShape

  - Defined in geometry/shape.d.ts:37

### contactShape

- contactShape(shapePos1, shapeRot1, shape2, shapePos2, shapeRot2, prediction): ShapeContact

- Computes one pair of contact points between two shapes.

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

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

  Inherited from Shape.contactShape

  - Defined in geometry/shape.d.ts:60

### containsPoint

- containsPoint(shapePos, shapeRot, point): boolean

- #### Parameters

  - shapePos: Vector
  - shapeRot: Rotation
  - point: Vector

  #### Returns boolean

  Inherited from Shape.containsPoint

  - Defined in geometry/shape.d.ts:61

### intersectsRay

- intersectsRay(ray, shapePos, shapeRot, maxToi): boolean

- #### Parameters

  - ray: Ray
  - shapePos: Vector
  - shapeRot: Rotation
  - maxToi: number

  #### Returns boolean

  Inherited from Shape.intersectsRay

  - Defined in geometry/shape.d.ts:63

### intersectsShape

- intersectsShape(shapePos1, shapeRot1, shape2, shapePos2, shapeRot2): boolean

- Tests if this shape intersects another shape.

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

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

  Inherited from Shape.intersectsShape

  - Defined in geometry/shape.d.ts:48

### intoRaw

- intoRaw(): RawShape

- #### Returns RawShape

  Overrides Shape.intoRaw

  - Defined in geometry/shape.d.ts:351

### projectPoint

- projectPoint(shapePos, shapeRot, point, solid): PointProjection

- #### Parameters

  - shapePos: Vector
  - shapeRot: Rotation
  - point: Vector
  - solid: boolean

  #### Returns PointProjection

  Inherited from Shape.projectPoint

  - Defined in geometry/shape.d.ts:62

### `Static` fromRaw

- fromRaw(rawSet, handle): Shape

- instant mode without cache

  #### Parameters

  - rawSet: RawColliderSet
  - handle: number

  #### Returns Shape

  Inherited from Shape.fromRaw

  - Defined in geometry/shape.d.ts:17