|
Emini Physics Engine 1.3.5a API Documentation | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectat.emini.physics2D.Contact
public class Contact
The Contact class represents a contact between two bodies.
The contacts are created during the collision detection step.
A contact can be a single or double contact of a collision between two bodies.
A single contact happens if the contact type is edge-face.
In case of two perpendicular bodies the contact type can be face-face.
This situation is a single contact object representing the double contact.
The extreme points of the face-face intersection line are contacts of the same bodies.
To achieve better stacking results, these are treated together
(Block solving).
Constructor Summary | |
---|---|
protected |
Contact(FXVector normal,
Body body1,
int index1,
Body body2,
int index2)
Constructor. |
protected |
Contact(FXVector contactPosition1,
FXVector contactPosition2,
Body body1,
Body body2)
Constructor using two absolute points. |
Method Summary | |
---|---|
protected void |
applyAccumImpulses()
Applies the accumulated impulses. |
protected boolean |
applyMomentum()
Applies the momentum of the collision. |
protected float |
applyMomentumPositionCorrectionFX()
Applies the position correction to the involved bodies. |
Body |
body1()
Gets the first body. |
Body |
body2()
Gets the second body. |
void |
clear()
Sets up the contact for reuse (same bodies). |
void |
clearAll()
Sets up the contact for reuse (different bodies). |
boolean |
concernsBody(Body body)
Checks is the contact applies to a body. |
FXVector |
getContactPosition1()
Gets contact position of the first contact point. |
FXVector |
getContactPosition2()
Gets contact position of the second contact point. |
float |
getDepth1FX()
Gets the penetration depth first contact point. |
float |
getDepth2FX()
Gets the penetration depth second contact point. |
float |
getImpulseContact1FX()
Gets the last acting impulse of the contact (position 1). |
float |
getImpulseContact2FX()
Gets the last acting impulse of the contact (position 2). |
FXVector |
getNormal()
Gets the contact normal. |
boolean |
isSingle()
Checks if the contact is a single point. |
protected void |
precalculate(float invTimestepFX)
Precalculates values for the constraint iteration. |
protected void |
precalculatePositionCorrection(float timestepFX,
float invTimestepFX)
|
int |
segment1()
Gets the segment index of the first body if it is the landscape or shape index in case of a multi shape. |
int |
segment2()
Gets the segment index of the second body if it is the landscape or shape index in case of a multi shape. |
void |
setContactPosition1(FXVector pos,
float depthFX,
boolean posAtBody1)
Sets the first contact position. |
void |
setContactPosition2(FXVector pos,
float depthFX,
boolean posAtBody1)
Sets the second contact position. |
void |
setNormal(FXVector normal,
Body b1,
int index1,
Body b2,
int index2)
Resets normal and bodies. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected Contact(FXVector normal, Body body1, int index1, Body body2, int index2)
normal
- - collision normalbody1
- Body 1body2
- Body 2protected Contact(FXVector contactPosition1, FXVector contactPosition2, Body body1, Body body2)
contactPosition1
- contact position on body 1contactPosition2
- contact position on body 2body1
- Body 1body2
- Body 2Method Detail |
---|
public final void setNormal(FXVector normal, Body b1, int index1, Body b2, int index2)
normal
- the contact normalb1
- Body 1b2
- Body 2public final void clear()
public final void clearAll()
public final void setContactPosition1(FXVector pos, float depthFX, boolean posAtBody1)
pos
- the absolute contact positiondepthFX
- the penetration depth for this contactposAtBody1
- flag indicating whether the position lies on body 1public final void setContactPosition2(FXVector pos, float depthFX, boolean posAtBody1)
pos
- the absolute contact positiondepthFX
- the penetration depth for this contactposAtBody1
- flag indicating whether the position lies on body 1public boolean isSingle()
public FXVector getContactPosition1()
public FXVector getContactPosition2()
public FXVector getNormal()
public Body body1()
public int segment1()
public Body body2()
public int segment2()
public float getDepth1FX()
public float getDepth2FX()
protected final void applyAccumImpulses()
protected final void precalculate(float invTimestepFX)
invTimestepFX
- the inverse timestep of the simulationprotected final void precalculatePositionCorrection(float timestepFX, float invTimestepFX)
timestepFX
- the timestep of the simulationinvTimestepFX
- the inverse timestep of the simulationprotected boolean applyMomentum()
protected float applyMomentumPositionCorrectionFX()
public boolean concernsBody(Body body)
body
- the body for which to check
public float getImpulseContact1FX()
public float getImpulseContact2FX()
|
Emini Physics Engine 1.3.5a API Documentation | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |