The XRRay()
constructor creates a new XRRay
object which is a geometric ray described by an origin point and a direction vector.
new XRRay()
new XRRay(origin)
new XRRay(origin, direction)
new XRRay(transform)
A newly-created XRRay
object.
The XRRay()
constructor allows to creating new rays by either providing an origin
point and a direction
vector, or by passing in an XRRigidTransform
object.
let ray1 = new XRRay();
let ray2 = new XRRay({ y: 0.5 });
let origin = { x: 10.0, y: 10.0, z: 10.0, w: 1.0 };
let direction = { x: 10.0, y: 0.0, z: 0.0, w: 0.0 };
let ray3 = new XRRay(origin, direction);
let ray4 = new XRRay(DOMPoint.fromPoint(origin), DOMPoint.fromPoint(direction));
let rigidTransform = new XRRigidTransform(
DOMPoint.fromPoint(origin),
DOMPoint.fromPoint(direction),
);
let ray5 = new XRRay(rigidTransform);