Search in sources :

Example 1 with ImmediateModePhysicsListener

use of com.gemserk.commons.artemis.components.PhysicsComponent.ImmediateModePhysicsListener 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);
}
Also used : ImmediateModePhysicsListener(com.gemserk.commons.artemis.components.PhysicsComponent.ImmediateModePhysicsListener) PhysicsComponent(com.gemserk.commons.artemis.components.PhysicsComponent)

Example 2 with ImmediateModePhysicsListener

use of com.gemserk.commons.artemis.components.PhysicsComponent.ImmediateModePhysicsListener 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);
}
Also used : ImmediateModePhysicsListener(com.gemserk.commons.artemis.components.PhysicsComponent.ImmediateModePhysicsListener) PhysicsComponent(com.gemserk.commons.artemis.components.PhysicsComponent)

Example 3 with ImmediateModePhysicsListener

use of com.gemserk.commons.artemis.components.PhysicsComponent.ImmediateModePhysicsListener in project commons-gdx by gemserk.

the class PhysicsContactListener method removeBodyFromContacts.

/**
	 * Removes body from entity contacts.
	 * 
	 * @param e
	 *            The entity to remove the contact from.
	 * @param body
	 *            The body to be removed from contacts.
	 */
private void removeBodyFromContacts(Entity e, Contact contact, boolean fixtureA) {
    if (e == null)
        return;
    PhysicsComponent physicsComponent = PhysicsComponent.get(e);
    if (physicsComponent == null)
        return;
    physicsComponent.getContact().removeContact(contact, fixtureA);
    ImmediateModePhysicsListener physicsListener = physicsComponent.physicsListener;
    if (physicsListener != null)
        physicsListener.endContact(e, contact, fixtureA);
}
Also used : ImmediateModePhysicsListener(com.gemserk.commons.artemis.components.PhysicsComponent.ImmediateModePhysicsListener) PhysicsComponent(com.gemserk.commons.artemis.components.PhysicsComponent)

Aggregations

PhysicsComponent (com.gemserk.commons.artemis.components.PhysicsComponent)3 ImmediateModePhysicsListener (com.gemserk.commons.artemis.components.PhysicsComponent.ImmediateModePhysicsListener)3