raycastTwoCallBacks method

void raycastTwoCallBacks(
  1. RayCastCallback callback,
  2. ParticleRaycastCallback particleCallback,
  3. Vector2 point1,
  4. Vector2 point2,
)

Ray-cast the world for all fixtures and particles in the path of the ray. Your callback controls whether you get the closest point, any point, or n-points. The ray-cast ignores shapes that contain the starting point.

point1 is the ray's starting point point2 is the ray's ending point

Implementation

void raycastTwoCallBacks(
  RayCastCallback callback,
  ParticleRaycastCallback particleCallback,
  Vector2 point1,
  Vector2 point2,
) {
  _raycastWrapper.broadPhase = contactManager.broadPhase;
  _raycastWrapper.callback = callback;
  _input.maxFraction = 1.0;
  _input.p1.setFrom(point1);
  _input.p2.setFrom(point2);
  contactManager.broadPhase.raycast(_raycastWrapper, _input);
  particleSystem.raycast(particleCallback, point1, point2);
}