- fix bullet ghost overlap, thanks to @iwgeric

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9449 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
nor..67 13 years ago
parent 3450b171c2
commit a1dd0f9061
  1. 17
      engine/src/bullet-native/com_jme3_bullet_objects_PhysicsGhostObject.cpp

@ -172,17 +172,24 @@ extern "C" {
class jmeGhostOverlapCallback : public btOverlapCallback {
JNIEnv* m_env;
jobject m_object;
btCollisionObject *m_ghost;
public:
jmeGhostOverlapCallback(JNIEnv *env, jobject object)
jmeGhostOverlapCallback(JNIEnv *env, jobject object, btCollisionObject *ghost)
:m_env(env),
m_object(object)
m_object(object),
m_ghost(ghost)
{
}
virtual ~jmeGhostOverlapCallback() {}
virtual bool processOverlap(btBroadphasePair& pair)
{
btCollisionObject *co1 = (btCollisionObject *)pair.m_pProxy1->m_clientObject;
jmeUserPointer *up1 = (jmeUserPointer*)co1 -> getUserPointer();
btCollisionObject *other;
if(pair.m_pProxy1->m_clientObject == m_ghost){
other = (btCollisionObject *)pair.m_pProxy0->m_clientObject;
}else{
other = (btCollisionObject *)pair.m_pProxy1->m_clientObject;
}
jmeUserPointer *up1 = (jmeUserPointer*)other -> getUserPointer();
jobject javaCollisionObject1 = m_env->NewLocalRef(up1->javaCollisionObject);
m_env->CallVoidMethod(m_object, jmeClasses::PhysicsGhostObject_addOverlappingObject, javaCollisionObject1);
m_env->DeleteLocalRef(javaCollisionObject1);
@ -209,7 +216,7 @@ extern "C" {
return;
}
btHashedOverlappingPairCache * pc = ghost->getOverlappingPairCache();
jmeGhostOverlapCallback cb(env, object);
jmeGhostOverlapCallback cb(env, object, ghost);
pc -> processAllOverlappingPairs(&cb, NULL);
}
/*

Loading…
Cancel
Save