Interface IRayHitHandler
- Namespace
- BepuPhysics
- Assembly
- BepuPhysics.dll
Defines a type capable of filtering ray test candidates and handling ray hit results.
public interface IRayHitHandler
Methods
AllowTest(CollidableReference)
Checks whether a collidable identified by the acceleration structure should be tested against a ray.
bool AllowTest(CollidableReference collidable)
Parameters
collidableCollidableReferenceCandidate collidable for ray testing.
Returns
- bool
True if the collidable should be tested by the ray, false otherwise.
AllowTest(CollidableReference, int)
Checks whether the child of a collidable should be tested against a ray. Only called by shape types that can have more than one child.
bool AllowTest(CollidableReference collidable, int childIndex)
Parameters
collidableCollidableReferenceParent of the candidate.
childIndexintIndex of the candidate in the parent collidable.
Returns
- bool
True if the child should be tested by the ray, false otherwise.
OnRayHit(in RayData, ref float, float, Vector3, CollidableReference, int)
Called when a ray impact has been found.
void OnRayHit(in RayData ray, ref float maximumT, float t, Vector3 normal, CollidableReference collidable, int childIndex)
Parameters
rayRayDataInformation about the ray associated with this hit.
maximumTfloatMaximum distance along the ray that the traversal is allowed to go in units of ray direction length. Can be set to limit future tests.
tfloatDistance along the ray to the impact in units of ray direction length. In other words, hitLocation = ray.Origin + ray.Direction * t.
normalVector3Surface normal at the hit location.
collidableCollidableReferenceCollidable hit by the ray.
childIndexintIndex of the hit child. For convex shapes or other types that don't have multiple children, this is always zero.