From 439c5b36b8696856b3caa8bb0a1cebe137952b23 Mon Sep 17 00:00:00 2001 From: "nor..67" Date: Thu, 3 Nov 2011 22:25:26 +0000 Subject: [PATCH] native bullet: - add ray test code, thanks to @EmpirePhoenix - clean up import structure - remove separate jmeUserPointer class git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@8577 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- .../bullet/com/jme3/bullet/PhysicsSpace.java | 22 +++--- .../collision/PhysicsRayTestResult.java | 25 +++---- .../com/jme3/bullet/joints/SliderJoint.java | 1 - engine/src/bullet/native/bullet.properties | 2 +- .../native/com_jme3_bullet_PhysicsSpace.cpp | 51 ++++++++++++- .../native/com_jme3_bullet_PhysicsSpace.h | 8 +++ ...ullet_collision_PhysicsCollisionObject.cpp | 1 - ...jme3_bullet_objects_PhysicsGhostObject.cpp | 2 +- engine/src/bullet/native/jmeBulletUtil.cpp | 31 ++++++-- engine/src/bullet/native/jmeBulletUtil.h | 9 +++ engine/src/bullet/native/jmeClasses.cpp | 71 ++++++++++++++++--- engine/src/bullet/native/jmeClasses.h | 8 +++ engine/src/bullet/native/jmePhysicsSpace.cpp | 3 +- engine/src/bullet/native/jmeUserPointer.h | 11 --- 14 files changed, 186 insertions(+), 59 deletions(-) delete mode 100644 engine/src/bullet/native/jmeUserPointer.h diff --git a/engine/src/bullet/com/jme3/bullet/PhysicsSpace.java b/engine/src/bullet/com/jme3/bullet/PhysicsSpace.java index 708d84c85..29f60526c 100644 --- a/engine/src/bullet/com/jme3/bullet/PhysicsSpace.java +++ b/engine/src/bullet/com/jme3/bullet/PhysicsSpace.java @@ -213,15 +213,14 @@ public class PhysicsSpace { physicsTickCallback.physicsTick(this, f); } } - - private void addCollision_native(){ - + + private void addCollision_native() { } - private boolean needCollision_native(PhysicsCollisionObject objectA, PhysicsCollisionObject objectB){ + private boolean needCollision_native(PhysicsCollisionObject objectA, PhysicsCollisionObject objectB) { return false; } - + // private void setOverlapFilterCallback() { // OverlapFilterCallback callback = new OverlapFilterCallback() { // @@ -333,6 +332,7 @@ public class PhysicsSpace { // System.out.println("addCollisionEvent:"+node.getObjectId()+" "+ node1.getObjectId()); collisionEvents.add(eventFactory.getEvent(PhysicsCollisionEvent.TYPE_PROCESSED, node, node1, manifoldPointObjectId)); } + /** * updates the physics space * @param time the current time value @@ -715,10 +715,10 @@ public class PhysicsSpace { /** * Performs a ray collision test and returns the results as a list of PhysicsRayTestResults */ - public List rayTest(Vector3f from, Vector3f to) { - List results = new LinkedList(); -// dynamicsWorld.rayTest(Converter.convert(from, rayVec1), Converter.convert(to, rayVec2), new InternalRayListener(results)); - return results; + public List rayTest(Vector3f from, Vector3f to) { + List results = new LinkedList(); + rayTest(from, to, results); + return (List) results; } /** @@ -726,10 +726,12 @@ public class PhysicsSpace { */ public List rayTest(Vector3f from, Vector3f to, List results) { results.clear(); -// dynamicsWorld.rayTest(Converter.convert(from, rayVec1), Converter.convert(to, rayVec2), new InternalRayListener(results)); + rayTest_native(from, to, physicsSpaceId, results); return results; } + public native void rayTest_native(Vector3f from, Vector3f to, long physicsSpaceId, List results); + // private class InternalRayListener extends CollisionWorld.RayResultCallback { // // private List results; diff --git a/engine/src/bullet/com/jme3/bullet/collision/PhysicsRayTestResult.java b/engine/src/bullet/com/jme3/bullet/collision/PhysicsRayTestResult.java index 1941344c3..d4b092dd3 100644 --- a/engine/src/bullet/com/jme3/bullet/collision/PhysicsRayTestResult.java +++ b/engine/src/bullet/com/jme3/bullet/collision/PhysicsRayTestResult.java @@ -35,23 +35,21 @@ import com.jme3.math.Vector3f; /** * Contains the results of a PhysicsSpace rayTest - * @author normenhansen + * bulletAppState.getPhysicsSpace().rayTest(new Vector3f(0,1000,0),new Vector3f(0,-1000,0)); + javap -s java.util.List + * @author Empire-Phoenix,normenhansen */ public class PhysicsRayTestResult { private PhysicsCollisionObject collisionObject; private Vector3f hitNormalLocal; private float hitFraction; - private boolean normalInWorldSpace; + private boolean normalInWorldSpace = true; - public PhysicsRayTestResult() { - } - - public PhysicsRayTestResult(PhysicsCollisionObject collisionObject, Vector3f hitNormalLocal, float hitFraction, boolean normalInWorldSpace) { - this.collisionObject = collisionObject; - this.hitNormalLocal = hitNormalLocal; - this.hitFraction = hitFraction; - this.normalInWorldSpace = normalInWorldSpace; + /** + * allocated by native code only + */ + private PhysicsRayTestResult() { } /** @@ -81,11 +79,4 @@ public class PhysicsRayTestResult { public boolean isNormalInWorldSpace() { return normalInWorldSpace; } - - public void fill(PhysicsCollisionObject collisionObject, Vector3f hitNormalLocal, float hitFraction, boolean normalInWorldSpace) { - this.collisionObject = collisionObject; - this.hitNormalLocal = hitNormalLocal; - this.hitFraction = hitFraction; - this.normalInWorldSpace = normalInWorldSpace; - } } diff --git a/engine/src/bullet/com/jme3/bullet/joints/SliderJoint.java b/engine/src/bullet/com/jme3/bullet/joints/SliderJoint.java index f979a3149..cc13a1329 100644 --- a/engine/src/bullet/com/jme3/bullet/joints/SliderJoint.java +++ b/engine/src/bullet/com/jme3/bullet/joints/SliderJoint.java @@ -35,7 +35,6 @@ import com.jme3.export.JmeExporter; import com.jme3.math.Matrix3f; import com.jme3.math.Vector3f; import com.jme3.bullet.objects.PhysicsRigidBody; -import com.jme3.bullet.util.Converter; import com.jme3.export.InputCapsule; import com.jme3.export.JmeImporter; import com.jme3.export.OutputCapsule; diff --git a/engine/src/bullet/native/bullet.properties b/engine/src/bullet/native/bullet.properties index 9cda82cd3..a81d1aa19 100644 --- a/engine/src/bullet/native/bullet.properties +++ b/engine/src/bullet/native/bullet.properties @@ -12,7 +12,7 @@ bullet.compile.debug=false # native library compilation options bullet.osx.compiler=g++ -bullet.osx.syslibroot=/Developer/SDKs/MacOSX10.5.sdk +bullet.osx.syslibroot=/Developer/SDKs/MacOSX10.5u.sdk # change this to msvc for MS Visual Studio compiler bullet.windows.compiler=g++ bullet.linux.compiler=g++ diff --git a/engine/src/bullet/native/com_jme3_bullet_PhysicsSpace.cpp b/engine/src/bullet/native/com_jme3_bullet_PhysicsSpace.cpp index c9e228f1b..8116f90a4 100644 --- a/engine/src/bullet/native/com_jme3_bullet_PhysicsSpace.cpp +++ b/engine/src/bullet/native/com_jme3_bullet_PhysicsSpace.cpp @@ -32,7 +32,7 @@ #include "com_jme3_bullet_PhysicsSpace.h" #include "jmePhysicsSpace.h" #include "jmeBulletUtil.h" -#include "jmeUserPointer.h" + /** * Author: Normen Hansen */ @@ -395,6 +395,55 @@ extern "C" { } delete(space); } + + JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_rayTest_1native + (JNIEnv * env, jobject object, jobject to, jobject from, jlong spaceId, jobject resultlist) { + + jmePhysicsSpace* space = reinterpret_cast (spaceId); + if (space == NULL) { + jclass newExc = env->FindClass("java/lang/NullPointerException"); + env->ThrowNew(newExc, "The physics space does not exist."); + return; + } + + struct AllRayResultCallback : public btCollisionWorld::RayResultCallback { + + AllRayResultCallback(const btVector3& rayFromWorld, const btVector3 & rayToWorld) : m_rayFromWorld(rayFromWorld), m_rayToWorld(rayToWorld) { + } + jobject resultlist; + JNIEnv* env; + btVector3 m_rayFromWorld; //used to calculate hitPointWorld from hitFraction + btVector3 m_rayToWorld; + + btVector3 m_hitNormalWorld; + btVector3 m_hitPointWorld; + + virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult& rayResult, bool normalInWorldSpace) { + if (normalInWorldSpace) { + m_hitNormalWorld = rayResult.m_hitNormalLocal; + } else { + m_hitNormalWorld = m_collisionObject->getWorldTransform().getBasis() * rayResult.m_hitNormalLocal; + } + m_hitPointWorld.setInterpolate3(m_rayFromWorld, m_rayToWorld, rayResult.m_hitFraction); + + jmeBulletUtil::addResult(env, resultlist, m_hitNormalWorld, m_hitPointWorld, rayResult.m_hitFraction, rayResult.m_collisionObject); + + return 1.f; + } + }; + + btVector3 native_to = btVector3(); + jmeBulletUtil::convert(env, to, &native_to); + + btVector3 native_from = btVector3(); + jmeBulletUtil::convert(env, from, &native_from); + + AllRayResultCallback resultCallback(native_from, native_to); + resultCallback.env = env; + resultCallback.resultlist = resultlist; + space->getDynamicsWorld()->rayTest(native_from, native_to, resultCallback); + return; + } #ifdef __cplusplus } diff --git a/engine/src/bullet/native/com_jme3_bullet_PhysicsSpace.h b/engine/src/bullet/native/com_jme3_bullet_PhysicsSpace.h index 8dd476cf0..3b14a7512 100644 --- a/engine/src/bullet/native/com_jme3_bullet_PhysicsSpace.h +++ b/engine/src/bullet/native/com_jme3_bullet_PhysicsSpace.h @@ -135,6 +135,14 @@ JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_removeConstraint JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_setGravity (JNIEnv *, jobject, jlong, jobject); +/* + * Class: com_jme3_bullet_PhysicsSpace + * Method: rayTest_native + * Signature: (Lcom/jme3/math/Vector3f;Lcom/jme3/math/Vector3f;JLjava/util/List;)V + */ +JNIEXPORT void JNICALL Java_com_jme3_bullet_PhysicsSpace_rayTest_1native + (JNIEnv *, jobject, jobject, jobject, jlong, jobject); + /* * Class: com_jme3_bullet_PhysicsSpace * Method: initNativePhysics diff --git a/engine/src/bullet/native/com_jme3_bullet_collision_PhysicsCollisionObject.cpp b/engine/src/bullet/native/com_jme3_bullet_collision_PhysicsCollisionObject.cpp index 67da006ec..5dc75b355 100644 --- a/engine/src/bullet/native/com_jme3_bullet_collision_PhysicsCollisionObject.cpp +++ b/engine/src/bullet/native/com_jme3_bullet_collision_PhysicsCollisionObject.cpp @@ -36,7 +36,6 @@ #include "com_jme3_bullet_collision_PhysicsCollisionObject.h" #include "jmeBulletUtil.h" #include "jmePhysicsSpace.h" -#include "jmeUserPointer.h" #ifdef __cplusplus extern "C" { diff --git a/engine/src/bullet/native/com_jme3_bullet_objects_PhysicsGhostObject.cpp b/engine/src/bullet/native/com_jme3_bullet_objects_PhysicsGhostObject.cpp index 0b46cd85c..092805d76 100644 --- a/engine/src/bullet/native/com_jme3_bullet_objects_PhysicsGhostObject.cpp +++ b/engine/src/bullet/native/com_jme3_bullet_objects_PhysicsGhostObject.cpp @@ -40,7 +40,7 @@ #include "BulletCollision/BroadphaseCollision/btOverlappingPairCache.h" #include "jmeBulletUtil.h" #include "jmePhysicsSpace.h" -#include "jmeUserPointer.h" + #ifdef __cplusplus extern "C" { #endif diff --git a/engine/src/bullet/native/jmeBulletUtil.cpp b/engine/src/bullet/native/jmeBulletUtil.cpp index e0a20ed2d..4bc899d45 100644 --- a/engine/src/bullet/native/jmeBulletUtil.cpp +++ b/engine/src/bullet/native/jmeBulletUtil.cpp @@ -33,23 +33,23 @@ #include "jmeBulletUtil.h" /** - * Author: Normen Hansen + * Author: Normen Hansen,Empire Phoenix, Lutherion */ void jmeBulletUtil::convert(JNIEnv* env, jobject in, btVector3* out) { if (in == NULL || out == NULL) { jmeClasses::throwNPE(env); } - float x = env->GetFloatField(in, jmeClasses::Vector3f_x);//env->CallFloatMethod(in, jmeClasses::Vector3f_getX); + float x = env->GetFloatField(in, jmeClasses::Vector3f_x); //env->CallFloatMethod(in, jmeClasses::Vector3f_getX); if (env->ExceptionCheck()) { env->Throw(env->ExceptionOccurred()); return; } - float y = env->GetFloatField(in, jmeClasses::Vector3f_y);//env->CallFloatMethod(in, jmeClasses::Vector3f_getY); + float y = env->GetFloatField(in, jmeClasses::Vector3f_y); //env->CallFloatMethod(in, jmeClasses::Vector3f_getY); if (env->ExceptionCheck()) { env->Throw(env->ExceptionOccurred()); return; } - float z = env->GetFloatField(in, jmeClasses::Vector3f_z);//env->CallFloatMethod(in, jmeClasses::Vector3f_getZ); + float z = env->GetFloatField(in, jmeClasses::Vector3f_z); //env->CallFloatMethod(in, jmeClasses::Vector3f_getZ); if (env->ExceptionCheck()) { env->Throw(env->ExceptionOccurred()); return; @@ -77,7 +77,7 @@ void jmeBulletUtil::convert(JNIEnv* env, const btVector3* in, jobject out) { return; } env->SetFloatField(out, jmeClasses::Vector3f_z, z); -// env->CallObjectMethod(out, jmeClasses::Vector3f_set, x, y, z); + // env->CallObjectMethod(out, jmeClasses::Vector3f_set, x, y, z); if (env->ExceptionCheck()) { env->Throw(env->ExceptionOccurred()); return; @@ -300,7 +300,26 @@ void jmeBulletUtil::convertQuat(JNIEnv* env, const btMatrix3x3* in, jobject out) return; } env->SetFloatField(out, jmeClasses::Quaternion_w, w); -// env->CallObjectMethod(out, jmeClasses::Quaternion_set, x, y, z, w); + // env->CallObjectMethod(out, jmeClasses::Quaternion_set, x, y, z, w); + if (env->ExceptionCheck()) { + env->Throw(env->ExceptionOccurred()); + return; + } +} + +void jmeBulletUtil::addResult(JNIEnv* env, jobject resultlist, btVector3 hitnormal, btVector3 m_hitPointWorld, btScalar m_hitFraction, btCollisionObject* hitobject) { + + jobject singleresult = env->AllocObject(jmeClasses::PhysicsRay_Class); + jobject hitnormalvec = env->AllocObject(jmeClasses::Vector3f); + + convert(env, const_cast (&hitnormal), hitnormalvec); + jmeUserPointer *up1 = (jmeUserPointer*) hitobject -> getUserPointer(); + + env->SetObjectField(singleresult, jmeClasses::PhysicsRay_normalInWorldSpace, hitnormalvec); + env->SetFloatField(singleresult, jmeClasses::PhysicsRay_hitfraction, m_hitFraction); + + env->SetObjectField(singleresult, jmeClasses::PhysicsRay_collisionObject, up1->javaCollisionObject); + env->CallVoidMethod(resultlist, jmeClasses::PhysicsRay_addmethod, singleresult); if (env->ExceptionCheck()) { env->Throw(env->ExceptionOccurred()); return; diff --git a/engine/src/bullet/native/jmeBulletUtil.h b/engine/src/bullet/native/jmeBulletUtil.h index d231bba73..bd211fd00 100644 --- a/engine/src/bullet/native/jmeBulletUtil.h +++ b/engine/src/bullet/native/jmeBulletUtil.h @@ -45,8 +45,17 @@ public: static void convert(JNIEnv* env, const btMatrix3x3* in, jobject out); static void convertQuat(JNIEnv* env, jobject in, btMatrix3x3* out); static void convertQuat(JNIEnv* env, const btMatrix3x3* in, jobject out); + static void addResult(JNIEnv* env, jobject resultlist, const btVector3 hitnormal,const btVector3 m_hitPointWorld,const btScalar m_hitFraction,btCollisionObject* hitobject); private: jmeBulletUtil(){}; ~jmeBulletUtil(){}; +}; + +class jmeUserPointer { +public: + jobject javaCollisionObject; + jint group; + jint groups; + void *space; }; \ No newline at end of file diff --git a/engine/src/bullet/native/jmeClasses.cpp b/engine/src/bullet/native/jmeClasses.cpp index 0d788e1e9..ce79ffa7a 100644 --- a/engine/src/bullet/native/jmeClasses.cpp +++ b/engine/src/bullet/native/jmeClasses.cpp @@ -33,7 +33,7 @@ #include /** - * Author: Normen Hansen + * Author: Normen Hansen,Empire Phoenix, Lutherion */ //public fields jclass jmeClasses::PhysicsSpace; @@ -81,6 +81,16 @@ jfieldID jmeClasses::Matrix3f_m22; jclass jmeClasses::DebugMeshCallback; jmethodID jmeClasses::DebugMeshCallback_addVector; +jclass jmeClasses::PhysicsRay_Class; +jmethodID jmeClasses::PhysicsRay_newSingleResult; + +jfieldID jmeClasses::PhysicsRay_normalInWorldSpace; +jfieldID jmeClasses::PhysicsRay_hitfraction; +jfieldID jmeClasses::PhysicsRay_collisionObject; + +jclass jmeClasses::PhysicsRay_listresult; +jmethodID jmeClasses::PhysicsRay_addmethod; + //private fields //JNIEnv* jmeClasses::env; JavaVM* jmeClasses::vm; @@ -103,7 +113,7 @@ void jmeClasses::initJavaClasses(JNIEnv* env) { // jmeClasses::env = env; env->GetJavaVM(&vm); - PhysicsSpace = env->FindClass("com/jme3/bullet/PhysicsSpace"); + PhysicsSpace = (jclass)env->NewGlobalRef(env->FindClass("com/jme3/bullet/PhysicsSpace")); if (env->ExceptionCheck()) { env->Throw(env->ExceptionOccurred()); return; @@ -117,7 +127,7 @@ void jmeClasses::initJavaClasses(JNIEnv* env) { return; } - PhysicsGhostObject = env->FindClass("com/jme3/bullet/objects/PhysicsGhostObject"); + PhysicsGhostObject = (jclass)env->NewGlobalRef(env->FindClass("com/jme3/bullet/objects/PhysicsGhostObject")); if (env->ExceptionCheck()) { env->Throw(env->ExceptionOccurred()); return; @@ -128,7 +138,7 @@ void jmeClasses::initJavaClasses(JNIEnv* env) { return; } - Vector3f = env->FindClass("com/jme3/math/Vector3f"); + Vector3f = (jclass)env->NewGlobalRef(env->FindClass("com/jme3/math/Vector3f")); Vector3f_set = env->GetMethodID(Vector3f, "set", "(FFF)Lcom/jme3/math/Vector3f;"); Vector3f_toArray = env->GetMethodID(Vector3f, "toArray", "([F)[F"); Vector3f_getX = env->GetMethodID(Vector3f, "getX", "()F"); @@ -138,7 +148,7 @@ void jmeClasses::initJavaClasses(JNIEnv* env) { Vector3f_y = env->GetFieldID(Vector3f, "y", "F"); Vector3f_z = env->GetFieldID(Vector3f, "z", "F"); - Quaternion = env->FindClass("com/jme3/math/Quaternion"); + Quaternion = (jclass)env->NewGlobalRef(env->FindClass("com/jme3/math/Quaternion")); if (env->ExceptionCheck()) { env->Throw(env->ExceptionOccurred()); return; @@ -153,7 +163,7 @@ void jmeClasses::initJavaClasses(JNIEnv* env) { Quaternion_z = env->GetFieldID(Quaternion, "z", "F"); Quaternion_w = env->GetFieldID(Quaternion, "w", "F"); - Matrix3f = env->FindClass("com/jme3/math/Matrix3f"); + Matrix3f = (jclass)env->NewGlobalRef(env->FindClass("com/jme3/math/Matrix3f")); if (env->ExceptionCheck()) { env->Throw(env->ExceptionOccurred()); return; @@ -174,17 +184,62 @@ void jmeClasses::initJavaClasses(JNIEnv* env) { Matrix3f_m21 = env->GetFieldID(Matrix3f, "m21", "F"); Matrix3f_m22 = env->GetFieldID(Matrix3f, "m22", "F"); - DebugMeshCallback = env->FindClass("com/jme3/bullet/util/DebugMeshCallback"); + DebugMeshCallback = (jclass)env->NewGlobalRef(env->FindClass("com/jme3/bullet/util/DebugMeshCallback")); if (env->ExceptionCheck()) { env->Throw(env->ExceptionOccurred()); return; } - + DebugMeshCallback_addVector = env->GetMethodID(DebugMeshCallback, "addVector", "(FFFII)V"); if (env->ExceptionCheck()) { env->Throw(env->ExceptionOccurred()); return; } + + PhysicsRay_Class = (jclass)env->NewGlobalRef(env->FindClass("com/jme3/bullet/collision/PhysicsRayTestResult")); + if (env->ExceptionCheck()) { + env->Throw(env->ExceptionOccurred()); + return; + } + + PhysicsRay_newSingleResult = env->GetMethodID(PhysicsRay_Class,"","()V"); + if (env->ExceptionCheck()) { + env->Throw(env->ExceptionOccurred()); + return; + } + + PhysicsRay_normalInWorldSpace = env->GetFieldID(PhysicsRay_Class,"hitNormalLocal","Lcom/jme3/math/Vector3f;"); + if (env->ExceptionCheck()) { + env->Throw(env->ExceptionOccurred()); + return; + } + + + PhysicsRay_hitfraction = env->GetFieldID(PhysicsRay_Class,"hitFraction","F"); + if (env->ExceptionCheck()) { + env->Throw(env->ExceptionOccurred()); + return; + } + + + PhysicsRay_collisionObject = env->GetFieldID(PhysicsRay_Class,"collisionObject","Lcom/jme3/bullet/collision/PhysicsCollisionObject;"); + if (env->ExceptionCheck()) { + env->Throw(env->ExceptionOccurred()); + return; + } + + PhysicsRay_listresult = env->FindClass("java/util/List"); + PhysicsRay_listresult = (jclass)env->NewGlobalRef(PhysicsRay_listresult); + if (env->ExceptionCheck()) { + env->Throw(env->ExceptionOccurred()); + return; + } + + PhysicsRay_addmethod = env->GetMethodID(PhysicsRay_listresult,"add","(Ljava/lang/Object;)Z"); + if (env->ExceptionCheck()) { + env->Throw(env->ExceptionOccurred()); + return; + } } void jmeClasses::throwNPE(JNIEnv* env) { diff --git a/engine/src/bullet/native/jmeClasses.h b/engine/src/bullet/native/jmeClasses.h index ef55e0cec..731b86f7b 100644 --- a/engine/src/bullet/native/jmeClasses.h +++ b/engine/src/bullet/native/jmeClasses.h @@ -81,6 +81,14 @@ public: static jfieldID Matrix3f_m21; static jfieldID Matrix3f_m22; + static jclass PhysicsRay_Class; + static jmethodID PhysicsRay_newSingleResult; + static jfieldID PhysicsRay_normalInWorldSpace; + static jfieldID PhysicsRay_hitfraction; + static jfieldID PhysicsRay_collisionObject; + static jclass PhysicsRay_listresult; + static jmethodID PhysicsRay_addmethod; + static jclass DebugMeshCallback; static jmethodID DebugMeshCallback_addVector; diff --git a/engine/src/bullet/native/jmePhysicsSpace.cpp b/engine/src/bullet/native/jmePhysicsSpace.cpp index 81c481f70..984517ac1 100644 --- a/engine/src/bullet/native/jmePhysicsSpace.cpp +++ b/engine/src/bullet/native/jmePhysicsSpace.cpp @@ -31,7 +31,6 @@ */ #include "jmePhysicsSpace.h" #include "jmeBulletUtil.h" -#include "jmeUserPointer.h" #include /** @@ -240,7 +239,7 @@ bool jmePhysicsSpace::contactProcessedCallback(btManifoldPoint &cp, void *body0, btCollisionObject* co1 = (btCollisionObject*) body1; jmeUserPointer *up1 = (jmeUserPointer*) co1 -> getUserPointer(); if (up0 != NULL) { - jmePhysicsSpace *dynamicsWorld = up0->space; + jmePhysicsSpace *dynamicsWorld = (jmePhysicsSpace *)up0->space; if (dynamicsWorld != NULL) { JNIEnv* env = dynamicsWorld->getEnv(); jobject javaPhysicsSpace = env->NewLocalRef(dynamicsWorld->getJavaPhysicsSpace()); diff --git a/engine/src/bullet/native/jmeUserPointer.h b/engine/src/bullet/native/jmeUserPointer.h deleted file mode 100644 index f7d058f8e..000000000 --- a/engine/src/bullet/native/jmeUserPointer.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef _Included_jmeUserPointer -#define _Included_jmeUserPointer -#include -class jmeUserPointer { -public: - jobject javaCollisionObject; - jint group; - jint groups; - jmePhysicsSpace *space; -}; -#endif \ No newline at end of file