# [name]

Representation of a ray in space.
Pretty useful for detecting collisions between objects in a scene.

## Constructor

### [name]( [page:Vector3 origin], [page:Vector3 direction], [page:Number near], [page:Number far])

## Properties

### .[page:Vector3 origin]

Where does the ray start. Default is *0, 0, 0*.

### .[page:Vector3 direction]

A vector pointing in the direction the ray goes. Default is *0, 0, 0*.

### .[page:Number near]

Defines the closest distance that will be checked for intersections, starting from origin. Default is *0*.

### .[page:Number far]

Defines the furthest distance that will be checked for intersections, starting from origin. Default is *Infinity*.
Hence, intersections will only be checked in the range *(near, far)*.

## Methods

### .setPrecision( [page:Float value] )

Defines the maximum precision used when determining intersections. This is specially important when checking collisions between almost parallel objects, and can make the difference between reporting a collision or not.
Default is *0.0001*

### .intersectObject( [page:Object3D object] ) [page:Object]

Determines whether the ray intersects *object*. The result is an array containing tuples of the form
`{ distance: // distance between the origin and the intersected object, point: // exact point where the intersection occurs, face: // exact face that the ray intersected, object: // the intersected object }`
Note that even if we're checking only an object against a ray, the ray can intersect the object in more than one point. Hence, the return value is an array and not a single tuple.

### .intersectObjects( [page:Array objects] ) [page:Array]

Goes through the *objects* array, and determine whether they ray intersects them. The result is an array that contains similar tuples to the ones returned by intersectObject
The entries in the returned array are sorted by ascending distance (i.e. closest objects first).

## Source

[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]