Combine result of both listeners to determine if the collision should occur (jbullet)

cleanup_build_scripts
Fadorico 9 years ago
parent 83b26be45a
commit f61b1439cc
  1. 10
      jme3-jbullet/src/main/java/com/jme3/bullet/PhysicsSpace.java

@ -237,12 +237,12 @@ public class PhysicsSpace {
|| (collisionObject1.getCollideWithGroups() & collisionObject.getCollisionGroup()) > 0) { || (collisionObject1.getCollideWithGroups() & collisionObject.getCollisionGroup()) > 0) {
PhysicsCollisionGroupListener listener = collisionGroupListeners.get(collisionObject.getCollisionGroup()); PhysicsCollisionGroupListener listener = collisionGroupListeners.get(collisionObject.getCollisionGroup());
PhysicsCollisionGroupListener listener1 = collisionGroupListeners.get(collisionObject1.getCollisionGroup()); PhysicsCollisionGroupListener listener1 = collisionGroupListeners.get(collisionObject1.getCollisionGroup());
if (listener != null) { if(listener != null){
return listener.collide(collisionObject, collisionObject1); collides = listener.collide(collisionObject, collisionObject1);
} else if (listener1 != null) { }
return listener1.collide(collisionObject, collisionObject1); if(listener1 != null && collisionObject.getCollisionGroup() != collisionObject1.getCollisionGroup()){
collides = listener1.collide(collisionObject, collisionObject1) && collides;
} }
return true;
} else { } else {
return false; return false;
} }

Loading…
Cancel
Save