This is an old revision of the document!
The Raycasting namespace provides functions for testing ray intersections with various shapes.
—- Functions —-
Tests if a ray intersects a sphere.
Parameters:
a
: Sphere
- The sphere to test.ray
: Ray
- The ray to test.Returns:
float
- The distance along the ray where the intersection occurs. If there is no intersection, returns a negative value.Tests if a ray intersects an axis-aligned bounding box (AABB).
Parameters:
aabb
: AABB
- The AABB to test.ray
: Ray
- The ray to test.Returns:
float
- The distance along the ray where the intersection occurs. If there is no intersection, returns a negative value.Tests if a ray intersects an oriented bounding box (OBB).
Parameters:
obb
: OrientedBox
- The OBB to test.ray
: Ray
- The ray to test.Returns:
float
- The distance along the ray where the intersection occurs. If there is no intersection, returns a negative value.Tests if a ray intersects a plane.
Parameters:
plane
: Plane
- The plane to test.ray
: Ray
- The ray to test.Returns:
float
- The distance along the ray where the intersection occurs. If there is no intersection, returns a negative value.Tests if a ray intersects a triangle.
Parameters:
triangle
: Triangle
- The triangle to test.ray
: Ray
- The ray to test.Returns:
float
- The distance along the ray where the intersection occurs. If there is no intersection, returns a negative value.Tests if a ray intersects a mesh.
Parameters:
mesh
: Mesh
- The mesh to test.ray
: Ray
- The ray to test.Returns:
float
- The distance along the ray where the intersection occurs. If there is no intersection, returns a negative value.Tests if a ray intersects an entity.
Parameters:
entity
: Entity
- The entity to test.ray
: Ray
- The ray to test.Returns:
float
- The distance along the ray where the intersection occurs. If there is no intersection, returns a negative value.Tests if a line intersects a sphere.
Parameters:
sphere
: Sphere
- The sphere to test.line
: Line
- The line to test.Returns:
bool
- true
if the line intersects the sphere, false
otherwise.Tests if a line intersects an axis-aligned bounding box (AABB).
Parameters:
aabb
: AABB
- The AABB to test.line
: Line
- The line to test.Returns:
bool
- true
if the line intersects the AABB, false
otherwise.Tests if a line intersects an oriented bounding box (OBB).
Parameters:
obb
: OrientedBox
- The OBB to test.line
: Line
- The line to test.Returns:
bool
- true
if the line intersects the OBB, false
otherwise.Tests if a line intersects a plane.
Parameters:
plane
: Plane
- The plane to test.line
: Line
- The line to test.Returns:
bool
- true
if the line intersects the plane, false
otherwise.Tests if a line intersects a triangle.
Parameters:
triangle
: Triangle
- The triangle to test.line
: Line
- The line to test.Returns:
bool
- true
if the line intersects the triangle, false
otherwise.Tests if a line intersects a mesh.
Parameters:
mesh
: Mesh
- The mesh to test.line
: Line
- The line to test.Returns:
bool
- true
if the line intersects the mesh, false
otherwise.Tests if a line intersects an entity.
Parameters:
entity
: Entity
- The entity to test.line
: Line
- The line to test.Returns:
bool
- true
if the line intersects the entity, false
otherwise.—- Support —-
Calculates the barycentric coordinates of a point in relation to a triangle.
Parameters:
p
: Point
- The point for which to calculate barycentric coordinates.t
: Triangle
- The triangle to use for the calculation.Returns:
Vector3
- The barycentric coordinates of the point in relation to the triangle.