From 6d0a5604c622999553019ba980da6dbf59962835 Mon Sep 17 00:00:00 2001 From: Normen Hansen Date: Tue, 13 Jan 2015 20:05:34 +0100 Subject: [PATCH] - fix pointer bug in native bullet addResult collision code (collision code still needs a rework) --- .../src/native/cpp/com_jme3_bullet_PhysicsSpace.cpp | 2 +- jme3-bullet-native/src/native/cpp/jmeBulletUtil.cpp | 4 ++-- jme3-bullet-native/src/native/cpp/jmeBulletUtil.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/jme3-bullet-native/src/native/cpp/com_jme3_bullet_PhysicsSpace.cpp b/jme3-bullet-native/src/native/cpp/com_jme3_bullet_PhysicsSpace.cpp index e20448d5a..b51630c55 100644 --- a/jme3-bullet-native/src/native/cpp/com_jme3_bullet_PhysicsSpace.cpp +++ b/jme3-bullet-native/src/native/cpp/com_jme3_bullet_PhysicsSpace.cpp @@ -448,7 +448,7 @@ extern "C" { } m_hitPointWorld.setInterpolate3(m_rayFromWorld, m_rayToWorld, rayResult.m_hitFraction); - jmeBulletUtil::addResult(env, resultlist, m_hitNormalWorld, m_hitPointWorld, rayResult.m_hitFraction, rayResult.m_collisionObject); + jmeBulletUtil::addResult(env, resultlist, &m_hitNormalWorld, &m_hitPointWorld, rayResult.m_hitFraction, rayResult.m_collisionObject); return 1.f; } diff --git a/jme3-bullet-native/src/native/cpp/jmeBulletUtil.cpp b/jme3-bullet-native/src/native/cpp/jmeBulletUtil.cpp index b584b83c0..fa88ad473 100644 --- a/jme3-bullet-native/src/native/cpp/jmeBulletUtil.cpp +++ b/jme3-bullet-native/src/native/cpp/jmeBulletUtil.cpp @@ -307,12 +307,12 @@ void jmeBulletUtil::convertQuat(JNIEnv* env, const btMatrix3x3* in, jobject out) } } -void jmeBulletUtil::addResult(JNIEnv* env, jobject resultlist, btVector3 hitnormal, btVector3 m_hitPointWorld, btScalar m_hitFraction, const btCollisionObject* hitobject) { +void jmeBulletUtil::addResult(JNIEnv* env, jobject resultlist, btVector3* hitnormal, btVector3* m_hitPointWorld, btScalar m_hitFraction, const btCollisionObject* hitobject) { jobject singleresult = env->AllocObject(jmeClasses::PhysicsRay_Class); jobject hitnormalvec = env->AllocObject(jmeClasses::Vector3f); - convert(env, const_cast (&hitnormal), hitnormalvec); + convert(env, hitnormal, hitnormalvec); jmeUserPointer *up1 = (jmeUserPointer*) hitobject -> getUserPointer(); env->SetObjectField(singleresult, jmeClasses::PhysicsRay_normalInWorldSpace, hitnormalvec); diff --git a/jme3-bullet-native/src/native/cpp/jmeBulletUtil.h b/jme3-bullet-native/src/native/cpp/jmeBulletUtil.h index 9ec758201..96509ab9e 100644 --- a/jme3-bullet-native/src/native/cpp/jmeBulletUtil.h +++ b/jme3-bullet-native/src/native/cpp/jmeBulletUtil.h @@ -45,7 +45,7 @@ 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,const btCollisionObject* hitobject); + static void addResult(JNIEnv* env, jobject resultlist, btVector3* hitnormal, btVector3* m_hitPointWorld,const btScalar m_hitFraction,const btCollisionObject* hitobject); private: jmeBulletUtil(){}; ~jmeBulletUtil(){};