Module org.dyn4j

Interface CollisionListener

    • Method Detail

      • collision

        boolean collision​(Body body1,
                          BodyFixture fixture1,
                          Body body2,
                          BodyFixture fixture2,
                          Manifold manifold)
        Called when two BodyFixtures are colliding and a contact Manifold has been found.

        Body objects can have many Convex Shapes that make up their geometry. Because of this, this method may be called multiple times if two multi-fixtured Bodys are colliding.

        Modification of the Manifold object is allowed. The Manifold is used to create contact constraints.

        Return false from this method to stop processing of this collision. Other CollisionListeners will still be notified of this event, however, no further collision or contact events will occur for this pair.

        The collision(ContactConstraint) method is next in the sequence of collision events.

        Parameters:
        body1 - the first Body
        fixture1 - the first Body's BodyFixture
        body2 - the second Body
        fixture2 - the second Body's BodyFixture
        manifold - the contact Manifold for the collision
        Returns:
        boolean true if processing should continue for this collision
      • collision

        boolean collision​(ContactConstraint contactConstraint)
        Called after a ContactConstraint has been created for a collision.

        Body objects can have many Convex Shapes that make up their geometry. Because of this, this method may be called multiple times if two multi-fixtured Bodys are colliding.

        Modification of the friction and restitution (both computed using the CoefficientMixer and sensor fields is allowed.

        Setting the tangent velocity of the ContactConstraint can create a conveyor effect.

        Return false from this method to stop processing of this collision. Other CollisionListeners will still be notified of this event, however, no further collision or contact events will occur for this pair.

        This is the last collision event before contact processing (via ContactListeners) occur.

        Parameters:
        contactConstraint - the contact constraint
        Returns:
        boolean true if processing should continue for this collision
        Since:
        3.0.2