Ray class

A line in 3D space that intersects bodies and return points.

Constructors

Ray.new([Vector3? from, Vector3? to])

Properties

a → Vector3
final
b → Vector3
final
c → Vector3
final
callback RaycastCallback
User-provided result callback. Will be used if mode is Ray.ALL.
getter/setter pair
checkCollisionResponse bool
Set to false if you don't want the Ray to take collisionResponse flags into account on bodies and shapes. @default true
getter/setter pair
collisionFilterGroup int
collisionFilterGroup @default -1
getter/setter pair
collisionFilterMask int
collisionFilterMask @default -1
getter/setter pair
d → Vector3
final
direction ↔ Vector3
getter/setter pair
from ↔ Vector3
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
hasHit bool
Will be set to true during intersectWorld() if the ray hit anything.
getter/setter pair
mode RayMode
The intersection mode. Should be any,all, closest. @default RayMode.any
getter/setter pair
precision double
The precision of the ray. Used when checking parallelity etc. default 0.0001
getter/setter pair
result RaycastResult
Current result object.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
skipBackfaces bool
If set to true, the ray skips any hits with normal.dot(rayDirection) < 0. @default false
getter/setter pair
to ↔ Vector3
getter/setter pair
worldPillarOffset → Vector3
final

Methods

getAABB(AABB aabb) → void
Get the world AABB of the ray.
intersectBodies(List<Body> bodies, [RaycastResult? result]) → void
Shoot a ray at an array bodies, get back information about the hit. @param bodies An array of Body objects. @deprecated @param result set the result property of the Ray instead.
intersectBody(Body body, [RaycastResult? result]) → void
Shoot a ray at a body, get back information about the hit. @deprecated @param result set the result property of the Ray instead.
intersectWorld(World world, RayOptions options) bool
Do itersection against all bodies in the given World. @return True if the ray hit anything, otherwise false.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited
operator [](ShapeType type) → dynamic

Static Methods

distanceFromIntersection(Vector3 from, Vector3 direction, Vector3 position) double
pointInTriangle(Vector3 p, Vector3 a, Vector3 b, Vector3 c, [Vector3? target]) bool
As per "Barycentric Technique" as named