- 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
3.0
nor..67 13 years ago
parent 3eebf80097
commit 425d459668
  1. 7
      engine/src/bullet/native/com_jme3_bullet_objects_PhysicsVehicle.cpp
  2. 4
      engine/src/bullet/native/com_jme3_bullet_util_DebugShapeFactory.cpp
  3. 1
      engine/src/bullet/native/com_jme3_bullet_util_DebugShapeFactory.h

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

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

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

Loading…
Cancel
Save