title: Ghost objects - bulletphysics
body: <p>I'm trying to implement a simple ghost object in bulletphysics, this is how I create the ghost objects:</p>
  
  <pre><code>btGhostPairCallback* ghostCall = new btGhostPairCallback();
  world-&gt;getBroadphase()-&gt;getOverlappingPairCache()-&gt;setInternalGhostPairCallback(ghostCall);
  
  btGhostObject* ghostObj = new btGhostObject();
  btCollisionShape* shape = new btBoxShape(btVector3(ofGetWidth()+1000, ofGetHeight()+1000, 50));
  ghostObj-&gt;setCollisionShape(shape);
  btTransform trans;
  trans.setIdentity();
  trans.setOrigin(btVector3(0,0,-500));
  ghostObj-&gt;setWorldTransform(trans);
  ghostObj-&gt;setCollisionFlags( btCollisionObject::CF_NO_CONTACT_RESPONSE);
  world-&gt;addCollisionObject(ghostObj,btBroadphaseProxy::SensorTrigger,btBroadphaseProxy::AllFilter &amp; ~btBroadphaseProxy::SensorTrigger);
  </code></pre>
  
  <p>and this is how to try to find the collision:</p>
  
  <pre><code>btCollisionObject* obj = world-&gt;getCollisionObjectArray()[j];
  btRigidBody* body = btRigidBody::upcast(obj);
  
      btAlignedObjectArray &lt; btCollisionObject* &gt; objsInsidePairCachingGhostObject;
      btAlignedObjectArray &lt; btCollisionObject* &gt;* pObjsInsideGhostObject = NULL;
      btGhostObject* ghost = btGhostObject::upcast(obj);
  
      if(ghost){
          objsInsidePairCachingGhostObject.resize(0);
          pObjsInsideGhostObject = &amp;ghost-&gt;getOverlappingPairs();
          cout &lt;&lt; ghost-&gt;getNumOverlappingObjects() &lt;&lt; endl;
  </code></pre>
  
  <p>but I always get a response that all my world objects are in collision with the ghost object.</p>
  
  <p>Anyone can help me to get a functional simple ghost object?</p>
  
  <p>thanks</p>