diff --git a/engine/lib/bullet/jME3-bullet-natives.jar b/engine/lib/bullet/jME3-bullet-natives.jar index 370f751bc..159ca85de 100644 Binary files a/engine/lib/bullet/jME3-bullet-natives.jar and b/engine/lib/bullet/jME3-bullet-natives.jar differ diff --git a/engine/lib/bullet/jarcontent/native/macosx/libbulletjme.jnilib b/engine/lib/bullet/jarcontent/native/macosx/libbulletjme.jnilib index 37ad44f34..5d8e79b1d 100755 Binary files a/engine/lib/bullet/jarcontent/native/macosx/libbulletjme.jnilib and b/engine/lib/bullet/jarcontent/native/macosx/libbulletjme.jnilib differ diff --git a/engine/src/bullet-native/com_jme3_bullet_PhysicsSpace.cpp b/engine/src/bullet-native/com_jme3_bullet_PhysicsSpace.cpp index 8116f90a4..37d00c219 100644 --- a/engine/src/bullet-native/com_jme3_bullet_PhysicsSpace.cpp +++ b/engine/src/bullet-native/com_jme3_bullet_PhysicsSpace.cpp @@ -332,6 +332,28 @@ extern "C" { space->getDynamicsWorld()->addConstraint(constraint); } + /* + * Class: com_jme3_bullet_PhysicsSpace + * Method: addConstraint + * Signature: (JJZ)V + */ + JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_addConstraintC + (JNIEnv * env, jobject object, jlong spaceId, jlong objectId, jboolean collision) { + jmePhysicsSpace* space = reinterpret_cast(spaceId); + btTypedConstraint* constraint = reinterpret_cast(objectId); + if (space == NULL) { + jclass newExc = env->FindClass("java/lang/NullPointerException"); + env->ThrowNew(newExc, "The physics space does not exist."); + return; + } + if (constraint == NULL) { + jclass newExc = env->FindClass("java/lang/NullPointerException"); + env->ThrowNew(newExc, "The constraint object does not exist."); + return; + } + space->getDynamicsWorld()->addConstraint(constraint, collision); + } + /* * Class: com_jme3_bullet_PhysicsSpace * Method: removeConstraint diff --git a/engine/src/bullet-native/com_jme3_bullet_PhysicsSpace.h b/engine/src/bullet-native/com_jme3_bullet_PhysicsSpace.h index 3b14a7512..bc5762dcc 100644 --- a/engine/src/bullet-native/com_jme3_bullet_PhysicsSpace.h +++ b/engine/src/bullet-native/com_jme3_bullet_PhysicsSpace.h @@ -119,6 +119,14 @@ JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_removeVehicle JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_addConstraint (JNIEnv *, jobject, jlong, jlong); +/* + * Class: com_jme3_bullet_PhysicsSpace + * Method: addConstraintC + * Signature: (JJZ)V + */ +JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_addConstraintC + (JNIEnv *, jobject, jlong, jlong, jboolean); + /* * Class: com_jme3_bullet_PhysicsSpace * Method: removeConstraint diff --git a/engine/src/bullet/com/jme3/bullet/PhysicsSpace.java b/engine/src/bullet/com/jme3/bullet/PhysicsSpace.java index 43ea670d1..d98135c90 100644 --- a/engine/src/bullet/com/jme3/bullet/PhysicsSpace.java +++ b/engine/src/bullet/com/jme3/bullet/PhysicsSpace.java @@ -561,6 +561,8 @@ public class PhysicsSpace { private native void removeVehicle(long space, long id); private native void addConstraint(long space, long id); + + private native void addConstraintC(long space, long id, boolean collision); private native void removeConstraint(long space, long id); @@ -626,7 +628,7 @@ public class PhysicsSpace { private void addJoint(PhysicsJoint joint) { Logger.getLogger(PhysicsSpace.class.getName()).log(Level.INFO, "Adding Joint {0} to physics space.", Long.toHexString(joint.getObjectId())); physicsJoints.add(joint); - addConstraint(physicsSpaceId, joint.getObjectId()); + addConstraintC(physicsSpaceId, joint.getObjectId(), !joint.isCollisionBetweenLinkedBodys()); // dynamicsWorld.addConstraint(joint.getObjectId(), !joint.isCollisionBetweenLinkedBodys()); }