Module org.dyn4j

Interface DetectListener

  • All Superinterfaces:
    Listener
    All Known Implementing Classes:
    DetectAdapter

    public interface DetectListener
    extends Listener
    Interface to listen for detection events from the World.detect methods.

    By default all methods should return true.

    Since:
    3.1.9
    Version:
    3.1.9
    Author:
    William Bittle
    • Method Detail

      • allow

        boolean allow​(AABB aabb,
                      Body body,
                      BodyFixture fixture)
        Called before the BodyFixture is tested against the given AABB.

        Return false from this method to eliminate this fixture from the list of results. Return false also improves performance by reducing the number of collision tests.

        This method is only called by the World.detect(AABB,...) methods.

        Parameters:
        aabb - the AABB given
        body - the Body whose AABB overlaps the given AABB
        fixture - the BodyFixture that is about to be tested
        Returns:
        boolean true to allow this body to be included in the results
      • allow

        boolean allow​(Convex convex,
                      Transform transform,
                      Body body)
        Called after the given Convex has been found to overlap the a Body.

        Return false from this method to eliminate this body from the list of results.

        This method is only called by the World.detect(Convex,...) methods.

        Parameters:
        convex - the convex given to the World.detect method
        transform - the transform given to the World.detect method
        body - the Body whose AABB overlaps the given AABB
        Returns:
        boolean true to allow this body to be included in the results
      • allow

        boolean allow​(Convex convex,
                      Transform transform,
                      Body body,
                      BodyFixture fixture)
        Called before the BodyFixture is tested against the given Convex.

        Return false from this method to eliminate this fixture from the list of results. Return false also improves performance by reducing the number of collision tests.

        This method is only called by the World.detect(Convex,...) methods.

        Parameters:
        convex - the convex given to the World.detect method
        transform - the transform given to the World.detect method
        body - the Body whose AABB overlaps the given AABB
        fixture - the BodyFixture that is about to be tested
        Returns:
        boolean true to allow this body to be included in the results