Ray class final

A ray: an origin and a direction.

The direction is not normalized automatically, and that is deliberate. Testing a mesh happens in the mesh's local space, which means transforming the ray by the inverse world matrix — and under scale that changes the direction's length. Leaving it alone is what keeps the returned t measured in the original space's units, so distances from differently scaled objects remain comparable. Call normalizeDirection when you want a unit ray.

A mutable object with out-style methods, because picking runs inside a pointer-move handler and should not allocate per candidate mesh.

Constructors

Ray(Vector3 origin, Vector3 direction)
Ray.zero()

Properties

direction → Vector3
final
hashCode → int
The hash code for this object.
no setterinherited
origin → Vector3
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

copyFrom(Ray other) → void
normalizeDirection() → Ray
Normalizes direction in place and returns this ray.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pointAt(double t, [Vector3? out]) → Vector3
The point at distance t along the ray.
setFrom(Vector3 origin, Vector3 direction) → void
toString() → String
A string representation of this object.
override
transformInto(Matrix4 inverse, Ray out) → Ray
Rewrites out as this ray expressed in the space inverse maps into.

Operators

operator ==(Object other) → bool
The equality operator.
inherited