Browse Source

- commit fixes to bullet native PhysicsVehicle and DebugShapeFactory (thanks to @chototsu)

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8392 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
nor..67 14 years ago
parent
commit
425d459668

+ 4 - 3
engine/src/bullet/native/com_jme3_bullet_objects_PhysicsVehicle.cpp

@@ -36,6 +36,7 @@
 
 #include "com_jme3_bullet_objects_PhysicsVehicle.h"
 #include "jmeBulletUtil.h"
+#include "jmePhysicsSpace.h"
 #include "BulletDynamics/Vehicle/btRaycastVehicle.h"
 
 #ifdef __cplusplus
@@ -66,13 +67,13 @@ extern "C" {
     JNIEXPORT jlong JNICALL Java_com_jme3_bullet_objects_PhysicsVehicle_createVehicleRaycaster
     (JNIEnv *env, jobject object, jlong bodyId, jlong spaceId) {
         //btRigidBody* body = (btRigidBody*) bodyId;
-        btDiscreteDynamicsWorld* spsace = (btDiscreteDynamicsWorld*) spaceId;
-        if (spsace == NULL) {
+        jmePhysicsSpace *space = (jmePhysicsSpace *)spaceId;
+        if (space == NULL) {
             jclass newExc = env->FindClass("java/lang/NullPointerException");
             env->ThrowNew(newExc, "The native object does not exist.");
             return 0;
         }
-        btDefaultVehicleRaycaster* caster = new btDefaultVehicleRaycaster(spsace);
+        btDefaultVehicleRaycaster* caster = new btDefaultVehicleRaycaster(space->getDynamicsWorld());
         return (long) caster;
     }
 

+ 2 - 2
engine/src/bullet/native/com_jme3_bullet_util_DebugShapeFactory.cpp

@@ -105,7 +105,7 @@ extern "C" {
             // Check there is a hull shape to render
             if (convexShape->getUserPointer() == NULL) {
                 // create a hull approximation
-                btShapeHull* hull = &btShapeHull(convexShape);
+                btShapeHull* hull = new btShapeHull(convexShape);
                 float margin = convexShape->getMargin();
                 hull->buildHull(margin);
                 convexShape->setUserPointer(hull);
@@ -146,7 +146,7 @@ extern "C" {
                     return;
                 }
             }
-
+            delete hull;
             convexShape->setUserPointer(NULL);
         }
     }

+ 0 - 1
engine/src/bullet/native/com_jme3_bullet_util_DebugShapeFactory.h

@@ -7,7 +7,6 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
-/* Inaccessible static: _00024assertionsDisabled */
 /*
  * Class:     com_jme3_bullet_util_DebugShapeFactory
  * Method:    getVertices