Package jsim.collision
Class ContactPoint
java.lang.Object
jsim.collision.ContactPoint
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 Summary
FieldsModifier and TypeFieldDescriptiondoubleAccumulated normal impulse for warm-starting (N·s), reset each tick.doubleAccumulated tangent impulse magnitude (N·s).First body (the one pushed in the normal direction).Second body.doubleCombined friction coefficient (dimensionless), filled in by the constraint builder.doubleCombined restitution coefficient (dimensionless), filled in by the constraint builder.doubleWorld-space contact point (midpoint of overlap region), in metres.doubleWorld-space contact point (midpoint of overlap region), in metres.doubleWorld-space contact point (midpoint of overlap region), in metres.doubleWorld-space contact normal (unit vector, dimensionless, points A←B).doubleWorld-space contact normal (unit vector, dimensionless, points A←B).doubleWorld-space contact normal (unit vector, dimensionless, points A←B).doublePenetration depth (positive = overlapping), in metres. -
Constructor Summary
ConstructorsConstructorDescriptionCreates an unpopulated contact point; callset(jsim.dynamics.RigidBody, jsim.dynamics.RigidBody, double, double, double, double, double, double, double)to fill it in. -
Method Summary
-
Field Details
-
bodyA
First body (the one pushed in the normal direction). -
bodyB
Second body. -
contactX
public double contactXWorld-space contact point (midpoint of overlap region), in metres. -
contactY
public double contactYWorld-space contact point (midpoint of overlap region), in metres. -
contactZ
public double contactZWorld-space contact point (midpoint of overlap region), in metres. -
normalX
public double normalXWorld-space contact normal (unit vector, dimensionless, points A←B). -
normalY
public double normalYWorld-space contact normal (unit vector, dimensionless, points A←B). -
normalZ
public double normalZWorld-space contact normal (unit vector, dimensionless, points A←B). -
penetration
public double penetrationPenetration depth (positive = overlapping), in metres. -
combinedFriction
public double combinedFrictionCombined friction coefficient (dimensionless), filled in by the constraint builder. -
combinedRestitution
public double combinedRestitutionCombined restitution coefficient (dimensionless), filled in by the constraint builder. -
accumulatedNormalImpulse
public double accumulatedNormalImpulseAccumulated normal impulse for warm-starting (N·s), reset each tick. -
accumulatedTangentImpulse
public double accumulatedTangentImpulseAccumulated tangent impulse magnitude (N·s).
-
-
Constructor Details
-
ContactPoint
public ContactPoint()Creates an unpopulated contact point; callset(jsim.dynamics.RigidBody, jsim.dynamics.RigidBody, double, double, double, double, double, double, double)to fill it in.
-
-
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 bodyb- second bodycx- 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)
-