Table of Contents

Interface IRayCastable

Namespace
Jitter2.Collision
Assembly
Jitter2.dll

Represents an entity that can be intersected by a ray.

public interface IRayCastable

Methods

RayCast(in JVector, in JVector, out JVector, out float)

Performs a ray cast against this object.

bool RayCast(in JVector origin, in JVector direction, out JVector normal, out float lambda)

Parameters

origin JVector

The starting point of the ray.

direction JVector

The direction of the ray. Does not need to be normalized.

normal JVector

The surface normal at the intersection point, or Zero if the ray origin is inside the object. Use the return value, not this parameter, to test whether a hit occurred.

lambda float

The distance along the ray to the intersection: hitPoint = origin + lambda * direction. Zero when the ray origin is inside the object.

Returns

bool

true if the ray intersects with the object; otherwise, false. Also returns true when the ray origin is inside the object, with lambda set to zero and normal set to Zero.