Module org.dyn4j

Class ContactPoint

    • Field Detail

      • body1

        protected final Body body1
        The first Body in contact
      • body2

        protected final Body body2
        The second Body in contact
      • point

        protected final Vector2 point
        The world space contact point
      • normal

        protected final Vector2 normal
        The world space contact normal
      • depth

        protected final double depth
        The penetration depth
      • sensor

        protected boolean sensor
        True if the contact is a sensor
    • Constructor Detail

      • ContactPoint

        public ContactPoint​(ContactPointId id,
                            Body body1,
                            BodyFixture fixture1,
                            Body body2,
                            BodyFixture fixture2,
                            Vector2 point,
                            Vector2 normal,
                            double depth,
                            boolean sensor)
        Full constructor.
        Parameters:
        id - the contact point id
        body1 - the first Body in contact
        fixture1 - the first Body's BodyFixture
        body2 - the second Body in contact
        fixture2 - the second Body's BodyFixture
        point - the world space contact point
        normal - the world space contact normal
        depth - the penetration depth
        sensor - true if the contact is a sensor contact
      • ContactPoint

        public ContactPoint​(ContactConstraint constraint,
                            Contact contact)
        Helper constructor for a contact constraint and contact.
        Parameters:
        constraint - the constraint
        contact - the contact
      • ContactPoint

        public ContactPoint​(ContactPoint contactPoint)
        Copy constructor (shallow).
        Parameters:
        contactPoint - the ContactPoint to copy
    • Method Detail

      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getPoint

        public Vector2 getPoint()
        Returns the contact point.
        Returns:
        Vector2
      • getNormal

        public Vector2 getNormal()
        Returns the normal.
        Returns:
        Vector2
      • getDepth

        public double getDepth()
        Returns the depth.
        Returns:
        double
      • getBody1

        public Body getBody1()
        Returns the first Body.
        Returns:
        Body
      • getBody2

        public Body getBody2()
        Returns the second Body.
        Returns:
        Body
      • isSensor

        public boolean isSensor()
        Returns true if this contact point is for a sensor.
        Returns:
        boolean