- fix pointer bug in native bullet addResult collision code (collision code still needs a rework)

experimental
Normen Hansen 10 years ago
parent 32f4245aff
commit 6d0a5604c6
  1. 2
      jme3-bullet-native/src/native/cpp/com_jme3_bullet_PhysicsSpace.cpp
  2. 4
      jme3-bullet-native/src/native/cpp/jmeBulletUtil.cpp
  3. 2
      jme3-bullet-native/src/native/cpp/jmeBulletUtil.h

@ -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;
}

@ -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<btVector3*> (&hitnormal), hitnormalvec);
convert(env, hitnormal, hitnormalvec);
jmeUserPointer *up1 = (jmeUserPointer*) hitobject -> getUserPointer();
env->SetObjectField(singleresult, jmeClasses::PhysicsRay_normalInWorldSpace, hitnormalvec);

@ -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(){};

Loading…
Cancel
Save