From f61b1439cc1ea63e456ea1ac6fca9c722dea2745 Mon Sep 17 00:00:00 2001 From: Fadorico Date: Thu, 31 Mar 2016 22:42:53 -0400 Subject: [PATCH] Combine result of both listeners to determine if the collision should occur (jbullet) --- .../src/main/java/com/jme3/bullet/PhysicsSpace.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/jme3-jbullet/src/main/java/com/jme3/bullet/PhysicsSpace.java b/jme3-jbullet/src/main/java/com/jme3/bullet/PhysicsSpace.java index 016440bf0..483343f72 100644 --- a/jme3-jbullet/src/main/java/com/jme3/bullet/PhysicsSpace.java +++ b/jme3-jbullet/src/main/java/com/jme3/bullet/PhysicsSpace.java @@ -237,12 +237,12 @@ public class PhysicsSpace { || (collisionObject1.getCollideWithGroups() & collisionObject.getCollisionGroup()) > 0) { PhysicsCollisionGroupListener listener = collisionGroupListeners.get(collisionObject.getCollisionGroup()); PhysicsCollisionGroupListener listener1 = collisionGroupListeners.get(collisionObject1.getCollisionGroup()); - if (listener != null) { - return listener.collide(collisionObject, collisionObject1); - } else if (listener1 != null) { - return listener1.collide(collisionObject, collisionObject1); + if(listener != null){ + collides = listener.collide(collisionObject, collisionObject1); + } + if(listener1 != null && collisionObject.getCollisionGroup() != collisionObject1.getCollisionGroup()){ + collides = listener1.collide(collisionObject, collisionObject1) && collides; } - return true; } else { return false; }