use of com.gemserk.commons.artemis.components.PhysicsComponent in project commons-gdx by gemserk.
the class PhysicsContactListener method addBodyToContacts.
/**
* Adds the body to the entity contacts.
*
* @param e
* The entity to add the contact to.
* @param body
* The body to add to the contacts.
* @param contact
* The real contact, used internally to get some data like normals and stuff.
*/
private void addBodyToContacts(Entity e, Contact contact, boolean fixtureA) {
if (e == null)
return;
PhysicsComponent physicsComponent = PhysicsComponent.get(e);
if (physicsComponent == null)
return;
physicsComponent.getContact().addContact(contact, fixtureA);
ImmediateModePhysicsListener physicsListener = physicsComponent.physicsListener;
if (physicsListener != null)
physicsListener.beginContact(e, contact, fixtureA);
}
use of com.gemserk.commons.artemis.components.PhysicsComponent in project commons-gdx by gemserk.
the class PhysicsContactListener method executePreSolveListener.
private void executePreSolveListener(Entity e, Contact contact, boolean fixtureA) {
if (e == null)
return;
PhysicsComponent physicsComponent = PhysicsComponent.get(e);
if (physicsComponent == null)
return;
ImmediateModePhysicsListener physicsListener = physicsComponent.physicsListener;
if (physicsListener != null)
physicsListener.preSolve(e, contact, fixtureA);
}
use of com.gemserk.commons.artemis.components.PhysicsComponent in project commons-gdx by gemserk.
the class PhysicsSystem method removed.
@Override
protected void removed(Entity e) {
PhysicsComponent physicsComponent = Components.getPhysicsComponent(e);
if (physicsComponent == null)
return;
Body body = physicsComponent.getBody();
body.setUserData(null);
// removes contact from the other entity
PhysicsUtils.releaseContacts(physicsComponent.getContact());
physicsWorld.destroyBody(body);
}
use of com.gemserk.commons.artemis.components.PhysicsComponent in project commons-gdx by gemserk.
the class PhysicsSystem method enabled.
@Override
protected void enabled(Entity e) {
PhysicsComponent physicsComponent = Components.getPhysicsComponent(e);
physicsComponent.getBody().setActive(true);
}
use of com.gemserk.commons.artemis.components.PhysicsComponent in project commons-gdx by gemserk.
the class PhysicsSystem method disabled.
@Override
protected void disabled(Entity e) {
PhysicsComponent physicsComponent = Components.getPhysicsComponent(e);
physicsComponent.getBody().setActive(false);
PhysicsUtils.releaseContacts(physicsComponent.getContact());
}
Aggregations