ReactPhysics3D  v0.10.2
C++ Physics engine library
Loading...
Searching...
No Matches
reactphysics3d::RaycastCallback Class Referenceabstract

This class can be used to register a callback for ray casting queries. More...

#include <include/reactphysics3d/collision/RaycastInfo.h>

Public Member Functions

virtual ~RaycastCallback ()
 Destructor.
 
virtual decimal notifyRaycastHit (const RaycastInfo &raycastInfo)=0
 This method will be called for each collider that is hit by the ray.
 

Detailed Description

This class can be used to register a callback for ray casting queries.

You should implement your own class inherited from this one and implement the notifyRaycastHit() method. This method will be called for each collider that is hit by the ray.

Member Function Documentation

◆ notifyRaycastHit()

virtual decimal reactphysics3d::RaycastCallback::notifyRaycastHit ( const RaycastInfo raycastInfo)
pure virtual

This method will be called for each collider that is hit by the ray.

You cannot make any assumptions about the order of the calls. You should use the return value to control the continuation of the ray. The returned value is the next maxFraction value to use. If you return a fraction of 0.0, it means that the raycast should terminate. If you return a fraction of 1.0, it indicates that the ray is not clipped and the ray cast should continue as if no hit occurred. If you return the fraction in the parameter (hitFraction value in the RaycastInfo object), the current ray will be clipped to this fraction in the next queries. If you return -1.0, it will ignore this collider and continue the ray cast.

Parameters
raycastInfoInformation about the raycast hit
Returns
Value that controls the continuation of the ray after a hit

The documentation for this class was generated from the following file: