Raycaster constructor
origin
— The origin vector where the ray casts from.
direction
— The direction vector that gives direction to
the ray. Should be normalized.
near
— All results returned are further away than near. Near
can't be negative. Default value is 0
.
far
— All results returned are closer than far. Far can't be
lower than near. Default value is Infinity.
This creates a new raycaster object.
Implementation
Raycaster([Vector3? origin, Vector3? direction, double? near, double? far]) {
ray = origin == null || direction == null?Ray():Ray.originDirection(origin, direction);
// direction is assumed to be normalized (for accurate distance calculations)
this.near = near ?? 0;
this.far = far ?? double.infinity;
layers = Layers();
params = {
"Mesh": {},
"Line": {"threshold": 1.0},
"LOD": {},
"Points": {"threshold": 1.0},
"Sprite": {}
};
}