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
childIndexintIndex 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
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.
childIndexintIndex 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.