Optionalox: number = 0
x of the origin
Optionaloy: number = 0
y of the origin
Optionaloz: number = 0
z of the origin
Optionaldx: number = 0
x of the direction
Optionaldy: number = 0
y of the direction
Optionaldz: number = 1
z of the direction (the default points down +Z, into the screen)
Copy another ray into this one.
the ray to copy
this ray, for chaining
Distance along the ray to where it enters an axis-aligned box; 0 when the origin is already inside it.
the box
the distance, or null on a miss
Distance along the ray to a plane, given a point on it and its normal (either side: the normal need not face the ray).
the distance, or null when the ray runs parallel to the plane or points away from it
Distance along the ray to where it enters a sphere; 0 when the origin is already inside it.
the sphere
the distance, or null on a miss
Set the origin and direction. The direction is normalized; a zero direction leaves the ray pointing down +Z.
x of the origin
y of the origin
z of the origin
x of the direction
y of the direction
z of the direction
this ray, for chaining
A 3D ray — an
originand a unitdirection— in the engine's 3D space (Y-down, +Z forward, the Camera3d convention).What a pointer is under a perspective camera: one screen pixel covers a whole line of world points, from the camera out through that pixel. Camera3d#screenToRay builds one, and Mesh#intersectRay, Camera3d#pick and the pointer events of a mesh under a
Camera3dall test against one.Every
intersect*method returns the distance along the ray to the first point where it enters the shape, ornullwhen it misses; the shape behind the ray's origin does not count. Ray3d#at turns a distance into the point.Example