public ContactSolver() { m_positionConstraints = new ContactPositionConstraint[INITIAL_NUM_CONSTRAINTS]; m_velocityConstraints = new ContactVelocityConstraint[INITIAL_NUM_CONSTRAINTS]; for (int i = 0; i < INITIAL_NUM_CONSTRAINTS; i++) { m_positionConstraints[i] = new ContactPositionConstraint(); m_velocityConstraints[i] = new ContactVelocityConstraint(); } }
/** Override the default restitution mixture. You can call this in b2ContactListener::PreSolve. The value persists until you set * or reset. */ public void setRestitution (float restitution) { contact.setRestitution(restitution); }
public void storeImpulses() { for (int i = 0; i < m_count; i++) { final ContactVelocityConstraint vc = m_velocityConstraints[i]; final Manifold manifold = m_contacts[vc.contactIndex].getManifold(); for (int j = 0; j < vc.pointCount; j++) { manifold.points[j].normalImpulse = vc.points[j].normalImpulse; manifold.points[j].tangentImpulse = vc.points[j].tangentImpulse; } } }
/** 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). */ public void setEnabled (boolean flag) { contact.setEnabled(flag); }
public ContactVelocityConstraint() { for (int i = 0; i < points.length; i++) { points[i] = new VelocityConstraintPoint(); } }
/** Get the child primitive index for fixture A. */ public int getChildIndexA () { return contact.getChildIndexA(); }
/** Get the child primitive index for fixture B. */ public int getChildIndexB () { return contact.getChildIndexB(); }
/** Has this contact been disabled? */ public boolean isEnabled () { return contact.isEnabled(); }
public void resetRestitution() { m_restitution = Contact.mixRestitution(m_fixtureA.m_restitution, m_fixtureB.m_restitution); }
public boolean isTouching () { return contact.isTouching(); }
public void resetFriction() { m_friction = Contact.mixFriction(m_fixtureA.m_friction, m_fixtureB.m_friction); }
protected Contact newInstance () { return new EdgeAndCircleContact(world); } protected Contact[] newArray(int size) { return new EdgeAndCircleContact[size]; }
protected Contact newInstance () { return new CircleContact(world); } protected Contact[] newArray(int size) { return new CircleContact[size]; }
public void setTangentSpeed (float speed) { contact.setTangentSpeed(speed); } }
/** Override the default friction mixture. You can call this in b2ContactListener::PreSolve. This value persists until set or * reset. */ public void setFriction (float friction) { contact.setFriction(friction); }
/** Get the friction. */ public float getFriction () { return contact.getFriction(); }
/** Reset the friction mixture to the default value. */ public void resetFriction () { contact.resetFriction(); }
/** Get the restitution. */ public float getRestitution () { return contact.getRestitution(); }
/** Reset the restitution to the default value. */ public void ResetRestitution () { contact.resetRestitution(); }
public float getTangentSpeed () { return contact.getTangentSpeed(); }