Module org.dyn4j

Interface RaycastListener

  • All Superinterfaces:
    Listener
    All Known Implementing Classes:
    RaycastAdapter

    public interface RaycastListener
    extends Listener
    Interface for listening for raycast events.

    Modification of the World is not permitted inside these methods.

    By default all methods should return true.

    Since:
    2.0.0
    Version:
    3.2.0
    Author:
    William Bittle
    • Method Detail

      • allow

        boolean allow​(Ray ray,
                      Body body,
                      BodyFixture fixture)
        Called before a BodyFixture is tested against the Ray.

        Use this method to filter the ray casting based on the BodyFixture.

        Parameters:
        ray - the Ray
        body - the Body
        fixture - the BodyFixture to be tested
        Returns:
        boolean true if the BodyFixture should be included in the raycast
        Since:
        3.0.0
      • allow

        boolean allow​(Ray ray,
                      Body body,
                      BodyFixture fixture,
                      Raycast raycast)
        Called after a successful raycast of the given Body and BodyFixture.

        Use this method to filter the raycasting based on the Raycast result.

        Parameters:
        ray - the Ray
        body - the Body
        fixture - the BodyFixture to be tested
        raycast - the Raycast result
        Returns:
        boolean true if the Raycast result should be allowed
        Since:
        3.1.5