Ray class

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

Constructors

Ray([Vec3? from, Vec3? to])

Properties

a Vec3
final
b Vec3
final
c Vec3
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 Vec3
final
direction Vec3
getter/setter pair
from Vec3
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 Vec3
getter/setter pair
worldPillarOffset Vec3
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(Vec3 from, Vec3 direction, Vec3 position) double
pointInTriangle(Vec3 p, Vec3 a, Vec3 b, Vec3 c, [Vec3? target]) bool
As per "Barycentric Technique" as named {@link https://www.blackpawn.com/texts/pointinpoly/default.html here} but without the division