Class ContactPoint

java.lang.Object
jsim.collision.ContactPoint

public final class ContactPoint extends Object
A single contact between two rigid bodies.

Convention: the contact normal points from body B toward body A (i.e. the direction body A is pushed to resolve the overlap). Penetration depth is positive when overlapping.

  • Field Details

    • bodyA

      public RigidBody bodyA
      First body (the one pushed in the normal direction).
    • bodyB

      public RigidBody bodyB
      Second body.
    • contactX

      public double contactX
      World-space contact point (midpoint of overlap region), in metres.
    • contactY

      public double contactY
      World-space contact point (midpoint of overlap region), in metres.
    • contactZ

      public double contactZ
      World-space contact point (midpoint of overlap region), in metres.
    • normalX

      public double normalX
      World-space contact normal (unit vector, dimensionless, points A←B).
    • normalY

      public double normalY
      World-space contact normal (unit vector, dimensionless, points A←B).
    • normalZ

      public double normalZ
      World-space contact normal (unit vector, dimensionless, points A←B).
    • penetration

      public double penetration
      Penetration depth (positive = overlapping), in metres.
    • combinedFriction

      public double combinedFriction
      Combined friction coefficient (dimensionless), filled in by the constraint builder.
    • combinedRestitution

      public double combinedRestitution
      Combined restitution coefficient (dimensionless), filled in by the constraint builder.
    • accumulatedNormalImpulse

      public double accumulatedNormalImpulse
      Accumulated normal impulse for warm-starting (N·s), reset each tick.
    • accumulatedTangentImpulse

      public double accumulatedTangentImpulse
      Accumulated tangent impulse magnitude (N·s).
  • Constructor Details

  • Method Details

    • set

      public void set(RigidBody a, RigidBody b, double cx, double cy, double cz, double nx, double ny, double nz, double penetration)
      Populate this contact with the given collision data.
      Parameters:
      a - first body
      b - second body
      cx - contact point X (metres)
      cy - contact point Y (metres)
      cz - contact point Z (metres)
      nx - contact normal X (unit vector)
      ny - contact normal Y (unit vector)
      nz - contact normal Z (unit vector)
      penetration - overlap depth (positive = overlapping, metres)