浏览代码

- fix collision between linked bodies option for joints in native bullet (thanks to @iwgeric)
- add fixed osx binary (win/linux are built on the server)

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9387 75d07b2b-3a1a-0410-a2c5-0572b91ccdca

nor..67 13 年之前
父节点
当前提交
7c18281818

二进制
engine/lib/bullet/jME3-bullet-natives.jar


二进制
engine/lib/bullet/jarcontent/native/macosx/libbulletjme.jnilib


+ 22 - 0
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<jmePhysicsSpace*>(spaceId);
+        btTypedConstraint* constraint = reinterpret_cast<btTypedConstraint*>(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

+ 8 - 0
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

+ 3 - 1
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());
     }