Module org.dyn4j

Interface ContactListener<T extends PhysicsBody>

    • Method Detail

      • begin

        void begin​(ContactCollisionData<T> collision,
                   Contact contact)
        Called when two BodyFixtures begin to overlap, generating a contact point.

        NOTE: The ContactConstraint stored in the collision parameter is being updated when this method is called. As a result, the data stored in the contact constraint may not be accurate. If you need to access the final state of the contact constraint, use the collision(ContactCollisionData, ContactConstraint) method.

        Parameters:
        collision - the collision data
        contact - the contact
      • end

        void end​(ContactCollisionData<T> collision,
                 Contact contact)
        Called when two BodyFixtures begin to separate and the contact point is no longer valid.

        This can happen in one of two ways. First, the fixtures in question have separated such that there's no longer any collision between them. Second, the fixtures could still be in collision, but the features that are in collision on those fixtures have changed.

        NOTE: The ContactConstraint stored in the collision parameter is being updated when this method is called. As a result, the data stored in the contact constraint may not be accurate. If you need to access the final state of the contact constraint, use the collision(ContactCollisionData, ContactConstraint) method.

        Parameters:
        collision - the collision data
        contact - the contact
      • preSolve

        void preSolve​(ContactCollisionData<T> collision,
                      Contact contact)
        Called before contact constraints are solved.
        Parameters:
        collision - the collision data
        contact - the contact
      • postSolve

        void postSolve​(ContactCollisionData<T> collision,
                       SolvedContact contact)
        Called after contacts have been solved.

        NOTE: This method will be called for SolvedContacts even when the SolvedContact.isSolved() is false. This should only occur in situations with multiple contact points that produce a linearly dependent system. These contacts are thus ignored during solving, but still reported here.

        Parameters:
        collision - the collision data
        contact - the contact