libgdx API

com.badlogic.gdx.physics.box2d
Class Contact

java.lang.Object
  extended by com.badlogic.gdx.physics.box2d.Contact

public class Contact
extends java.lang.Object

The 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.

Author:
mzechner

Field Summary
protected  long addr
          the address
protected  World world
          the world
protected  WorldManifold worldManifold
          the world manifold
 
Constructor Summary
protected Contact(World world, long addr)
           
 
Method Summary
 int getChildIndexA()
          Get the child primitive index for fixture A.
 int getChildIndexB()
          Get the child primitive index for fixture B.
 Fixture getFixtureA()
          Get the first fixture in this contact.
 Fixture getFixtureB()
          Get the second fixture in this contact.
 float getFriction()
          Get the friction.
 float getRestitution()
          Get the restitution.
 WorldManifold getWorldManifold()
           
 boolean isEnabled()
          Has this contact been disabled?
 boolean isTouching()
           
 void resetFriction()
          Reset the friction mixture to the default value.
 void ResetRestitution()
          Reset the restitution to the default value.
 void setEnabled(boolean flag)
          Enable/disable this contact.
 void setFriction(float friction)
          Override the default friction mixture.
 void setRestitution(float restitution)
          Override the default restitution mixture.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

addr

protected long addr
the address


world

protected World world
the world


worldManifold

protected final WorldManifold worldManifold
the world manifold

Constructor Detail

Contact

protected Contact(World world,
                  long addr)
Method Detail

getWorldManifold

public WorldManifold getWorldManifold()

isTouching

public boolean isTouching()

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).


isEnabled

public boolean isEnabled()
Has this contact been disabled?


getFixtureA

public Fixture getFixtureA()
Get the first fixture in this contact.


getFixtureB

public Fixture getFixtureB()
Get the second fixture in this contact.


getChildIndexA

public int getChildIndexA()
Get the child primitive index for fixture A.


getChildIndexB

public int getChildIndexB()
Get the child primitive index for fixture B.


setFriction

public void setFriction(float friction)
Override the default friction mixture. You can call this in b2ContactListener::PreSolve. This value persists until set or reset.


getFriction

public float getFriction()
Get the friction.


resetFriction

public void resetFriction()
Reset the friction mixture to the default value.


setRestitution

public void setRestitution(float restitution)
Override the default restitution mixture. You can call this in b2ContactListener::PreSolve. The value persists until you set or reset.


getRestitution

public float getRestitution()
Get the restitution.


ResetRestitution

public void ResetRestitution()
Reset the restitution to the default value.


libgdx API

Copyright 2010 Mario Zechner (contact@badlogicgames.com), Nathan Sweet (admin@esotericsoftware.com)