CLASSES
TagsA - Z

Ray

Description

class Ray

Constructor

new Ray(origin, direction, length)

Defines a Ray

Parameters

Name Type Description
origin Vector3 The origin point The origin point The origin point The origin point The origin point
direction Vector3 The initial vector describing the direction of the Ray
optional length number

Members

origin : Vector3

The starting point of the Ray

direction : Vector3

The vector describing the direction of the Ray

length : number

Methods

intersectsBoxMinMax(minimum, maximum) boolean

Tests if the ray intersects with the box defined by minimum and maximum

Parameters

Name Type Description
minimum Vector3 The minimum vector defining the box
maximum Vector3 The maximum vector defining the box

intersectsBox(box) boolean

Tests if the ray intersects with the given box

Parameters

Name Type Description
box BoundingBox The box to test with

intersectsSphere(sphere) boolean

Tests if the ray intersects with the given Sphere

Parameters

Name Type Description
sphere BoundingSphere The sphere to test with

intersectsTriangle(vertex0, vertex1, vertex2) IntersectionInfo

Tests if the ray intersects with the given triangle defined by the three vectors

Parameters

Name Type Description
vertex0 Vector3 The first vector defining the triangle
vertex1 Vector3 The second vector defining the triangle
vertex2 Vector3 The third vector defining the triangle

intersectsPlane(plane) number

Parameters

Name Type Description
plane Plane

intersectsMesh(mesh, fastCheck) PickingInfo

Parameters

Name Type Description
mesh AbstractMesh
optional fastCheck boolean

intersectsMeshes(meshes, fastCheck, results) Array<PickingInfo>

Parameters

Name Type Description
meshes Array<AbstractMesh>
optional fastCheck boolean
optional results Array<PickingInfo>

intersectionSegment(sega, segb, threshold) number

Intersection test between the ray and a given segment whithin a given tolerance (threshold)

@return the distance from the ray origin to the intersection point if there's intersection, or -1 if there's no intersection

Parameters

Name Type Description
sega Vector3 the first point of the segment to test the intersection against the first point of the segment to test the intersection against the first point of the segment to test the intersection against
segb Vector3 the second point of the segment to test the intersection against the second point of the segment to test the intersection against the second point of the segment to test the intersection against
threshold number the tolerance margin, if the ray doesn't intersect the segment but is close to the given threshold, the intersection is successful the tolerance margin, if the ray doesn't intersect the segment but is close to the given threshold, the intersection is successful the tolerance margin, if the ray doesn't intersect the segment but is close to the given threshold, the intersection is successful

static CreateNew(x, y, viewportWidth, viewportHeight, world, view, projection) Ray

Creates new Ray

Parameters

Name Type Description
x number @param x
y number @param y
viewportWidth number @param viewportWidth
viewportHeight number @param viewportHeight
world Matrix a matrix to transform the ray to. Default is the identity matrix. a matrix to transform the ray to. Default is the identity matrix. a matrix to transform the ray to. Default is the identity matrix. a matrix to transform the ray to. Default is the identity matrix. a matrix to transform the ray to. Default is the identity matrix.
view Matrix @param view

static CreateNewFromTo(origin, end, world) Ray

Function will create a new transformed ray starting from origin and ending at the end point. Ray's length will be set, and ray will be

transformed to the given world matrix.

Parameters

Name Type Description
origin Vector3 The origin point The origin point The origin point The origin point The origin point The origin point
end Vector3 The end point The end point The end point The end point The end point The end point
optional world Matrix a matrix to transform the ray to. Default is the identity matrix. a matrix to transform the ray to. Default is the identity matrix. a matrix to transform the ray to. Default is the identity matrix. a matrix to transform the ray to. Default is the identity matrix. a matrix to transform the ray to. Default is the identity matrix. a matrix to transform the ray to. Default is the identity matrix.

static Transform(ray, matrix) Ray

Parameters

Name Type Description
ray Ray The given ray
matrix Matrix The given matrix to apply

static TransformToRef(ray, matrix, result) void

Parameters

Name Type Description
ray Ray The given ray
matrix Matrix The given matrix to apply
result Ray