Interface IShapeRayHitHandler
- Namespace
- BepuPhysics
- Assembly
- BepuPhysics.dll
public interface IShapeRayHitHandler
Methods
AllowTest(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(int childIndex)
Parameters
childIndex
intIndex of the candidate in the parent collidable.
For compounds, this is the index of the child in the child array. For meshes, this is the triangle index. For convex shapes or other types that don't have multiple children, this is always zero.
Returns
- bool
True if the child should be tested by the ray, false otherwise.
OnRayHit(in RayData, ref float, float, Vector3, int)
Called when a ray impact has been found.
void OnRayHit(in RayData ray, ref float maximumT, float t, Vector3 normal, int childIndex)
Parameters
ray
RayDataInformation about the ray associated with this hit.
maximumT
floatMaximum distance along the ray that the traversal is allowed to go in units of ray direction length. Can be set to limit future tests.
t
floatDistance along the ray to the impact in units of ray direction length. In other words, hitLocation = ray.Origin + ray.Direction * t.
normal
Vector3Surface normal at the hit location.
childIndex
intIndex of the hit child.
For compounds, this is the index of the child in the child array. For meshes, this is the triangle index. For convex shapes or other types that don't have multiple children, this is always zero.