Package org.jbox2d.dynamics.contacts
Class Contact
- java.lang.Object
-
- org.jbox2d.dynamics.contacts.Contact
-
- Direct Known Subclasses:
ChainAndCircleContact,ChainAndPolygonContact,CircleContact,EdgeAndCircleContact,EdgeAndPolygonContact,PolygonAndCircleContact,PolygonContact
public abstract class Contact extends java.lang.ObjectThe class manages contact between two shapes. A contact exists for each overlapping AABB in the broad-phase (except if filtered). Therefore a contact object may exist that has no contact points.
-
-
Field Summary
Fields Modifier and Type Field Description static intBULLET_HIT_FLAGstatic intENABLED_FLAGstatic intFILTER_FLAGstatic intISLAND_FLAGFixturem_fixtureAFixturem_fixtureBintm_flagsfloatm_frictionintm_indexAintm_indexBManifoldm_manifoldContactm_nextContactEdgem_nodeAContactEdgem_nodeBContactm_prevfloatm_restitutionfloatm_tangentSpeedfloatm_toifloatm_toiCountprivate ManifoldoldManifoldprotected IWorldPoolpoolstatic intTOI_FLAGstatic intTOUCHING_FLAG
-
Constructor Summary
Constructors Modifier Constructor Description protectedContact(IWorldPool argPool)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidevaluate(Manifold manifold, Transform xfA, Transform xfB)voidflagForFiltering()Flag this contact for filtering.intgetChildIndexA()intgetChildIndexB()FixturegetFixtureA()Get the first fixture in this contact.FixturegetFixtureB()Get the second fixture in this contact.floatgetFriction()ManifoldgetManifold()Get the contact manifold.ContactgetNext()Get the next contact in the world's contact list.floatgetRestitution()floatgetTangentSpeed()voidgetWorldManifold(WorldManifold worldManifold)Get the world manifold.voidinit(Fixture fA, int indexA, Fixture fB, int indexB)initialization for poolingbooleanisEnabled()Has this contact been disabled?booleanisTouching()Is this contact touchingstatic floatmixFriction(float friction1, float friction2)Friction mixing law.static floatmixRestitution(float restitution1, float restitution2)Restitution mixing law.voidresetFriction()voidresetRestitution()voidsetEnabled(boolean flag)Enable/disable this contact.voidsetFriction(float friction)voidsetRestitution(float restitution)voidsetTangentSpeed(float speed)voidupdate(ContactListener listener)
-
-
-
Field Detail
-
ISLAND_FLAG
public static final int ISLAND_FLAG
- See Also:
- Constant Field Values
-
TOUCHING_FLAG
public static final int TOUCHING_FLAG
- See Also:
- Constant Field Values
-
ENABLED_FLAG
public static final int ENABLED_FLAG
- See Also:
- Constant Field Values
-
FILTER_FLAG
public static final int FILTER_FLAG
- See Also:
- Constant Field Values
-
BULLET_HIT_FLAG
public static final int BULLET_HIT_FLAG
- See Also:
- Constant Field Values
-
TOI_FLAG
public static final int TOI_FLAG
- See Also:
- Constant Field Values
-
m_flags
public int m_flags
-
m_prev
public Contact m_prev
-
m_next
public Contact m_next
-
m_nodeA
public ContactEdge m_nodeA
-
m_nodeB
public ContactEdge m_nodeB
-
m_fixtureA
public Fixture m_fixtureA
-
m_fixtureB
public Fixture m_fixtureB
-
m_indexA
public int m_indexA
-
m_indexB
public int m_indexB
-
m_manifold
public final Manifold m_manifold
-
m_toiCount
public float m_toiCount
-
m_toi
public float m_toi
-
m_friction
public float m_friction
-
m_restitution
public float m_restitution
-
m_tangentSpeed
public float m_tangentSpeed
-
pool
protected final IWorldPool pool
-
oldManifold
private final Manifold oldManifold
-
-
Constructor Detail
-
Contact
protected Contact(IWorldPool argPool)
-
-
Method Detail
-
getManifold
public Manifold getManifold()
Get the contact manifold. Do not set the point count to zero. Instead call Disable.
-
getWorldManifold
public void getWorldManifold(WorldManifold worldManifold)
Get the world manifold.
-
isTouching
public boolean isTouching()
Is this contact touching- Returns:
-
setEnabled
public void setEnabled(boolean flag)
Enable/disable this contact. This can be used inside the pre-solve contact listener. The contact is only disabled for the current time step (or sub-step in continuous collisions).- Parameters:
flag-
-
isEnabled
public boolean isEnabled()
Has this contact been disabled?- Returns:
-
getNext
public Contact getNext()
Get the next contact in the world's contact list.- Returns:
-
getFixtureA
public Fixture getFixtureA()
Get the first fixture in this contact.- Returns:
-
getChildIndexA
public int getChildIndexA()
-
getFixtureB
public Fixture getFixtureB()
Get the second fixture in this contact.- Returns:
-
getChildIndexB
public int getChildIndexB()
-
setFriction
public void setFriction(float friction)
-
getFriction
public float getFriction()
-
resetFriction
public void resetFriction()
-
setRestitution
public void setRestitution(float restitution)
-
getRestitution
public float getRestitution()
-
resetRestitution
public void resetRestitution()
-
setTangentSpeed
public void setTangentSpeed(float speed)
-
getTangentSpeed
public float getTangentSpeed()
-
flagForFiltering
public void flagForFiltering()
Flag this contact for filtering. Filtering will occur the next time step.
-
update
public void update(ContactListener listener)
-
mixFriction
public static final float mixFriction(float friction1, float friction2)Friction mixing law. The idea is to allow either fixture to drive the restitution to zero. For example, anything slides on ice.- Parameters:
friction1-friction2-- Returns:
-
mixRestitution
public static final float mixRestitution(float restitution1, float restitution2)Restitution mixing law. The idea is allow for anything to bounce off an inelastic surface. For example, a superball bounces on anything.- Parameters:
restitution1-restitution2-- Returns:
-
-