#

API Docs for: 0.6.0
Show: Inherited Protected Private Deprecated

# Ray Class

Defined in: `src/collision/Ray.js:12`

A line in 3D space that intersects bodies and return points.

## Constructor

### `Ray`

(

- `from`
- `to`

)

Defined in `src/collision/Ray.js:12`

#### Parameters:

- `from` Vec3
- `to` Vec3

- Index
- Methods
- Properties

## Item Index

### Methods

- intersectBodies
- intersectBody
- intersectShape

### Properties

- from
- precision
- to

## Methods

### `intersectBodies`

(

- `bodies`

)
Array

Defined in `src/collision/Ray.js:95`

#### Parameters:

- `bodies` Array

  An array of Body objects.

#### Returns:

Array:

See intersectBody

### `intersectBody`

(

- `body`

)
Array

Defined in `src/collision/Ray.js:64`

Shoot a ray at a body, get back information about the hit.

#### Parameters:

- `body` Body

#### Returns:

Array:

An array of results. The result objects has properties: distance (float), point (Vec3) and body (Body).

### `intersectShape`

(

- `shape`
- `quat`
- `position`
- `body`

)
Array

Defined in `src/collision/Ray.js:118`

#### Parameters:

- `shape` Shape
- `quat` Quaternion
- `position` Vec3
- `body` Body

#### Returns:

Array:

See intersectBody()

## Properties

### `from`

Vec3

Defined in `src/collision/Ray.js:20`

### `precision`

Number

Defined in `src/collision/Ray.js:32`

The precision of the ray. Used when checking parallelity etc.

### `to`

Vec3

Defined in `src/collision/Ray.js:25`