Panda Bullet

This is what I used for testing:

  def update(self, task):
    dt = globalClock.getDt()
    self.processInput(dt)
    self.world.doPhysics(dt, 10, 0.008)
    print self.world.getManifolds()
    return task.cont

  def cleanup(self):
    self.world = None
    self.worldNP.removeNode()

  def onContactAdded(self, node1, node2):
    print 'ADDED:', node1, node2

  def onContactDestroyed(self, node1, node2):
    print 'DESTROYED:', node1, node2

  def setup(self):
    self.worldNP = render.attachNewNode('World')

    # World
    self.debugNP = self.worldNP.attachNewNode(BulletDebugNode('Debug'))
    self.debugNP.show()

    self.world = BulletWorld()
    self.world.setDebugNode(self.debugNP.node())

    # Sphere 1
    shape = BulletSphereShape(0.6)
    np = self.worldNP.attachNewNode(BulletRigidBodyNode('S1'))
    np.node().setMass(1.0)
    np.node().addShape(shape)
    np.node().setDeactivationEnabled(False)
    np.setPos(3, 0, 0)
    np.setCollideMask(BitMask32.allOn())
    np.node().setCollisionResponse(False)
    np.node().notifyCollisions(True)
    self.world.attachRigidBody(np.node())

    self.body = np.node()

    # Sphere 2
    shape = BulletSphereShape(0.6)
    np = self.worldNP.attachNewNode(BulletRigidBodyNode('S2'))
    np.node().setMass(1.0)
    np.node().addShape(shape)
    np.setPos(-3, 0, 0)
    np.setCollideMask(BitMask32.allOn())
    np.node().setCollisionResponse(False)
    np.node().notifyCollisions(True)
    self.world.attachRigidBody(np.node())

    # Enable contact reporting
    self.accept('bullet-contact-added', self.onContactAdded)
    self.accept('bullet-contact-destroyed', self.onContactDestroyed)

Only the relevant part of the script. Two bodies, each with disababled collision response. And this is the output I get for a single pass of sphere-1 through sphere-2:

[]
[]
[]
[]
[<libpandabullet.BulletPersistentManifold object at 0x03187698>]
[<libpandabullet.BulletPersistentManifold object at 0x031876C8>]
[<libpandabullet.BulletPersistentManifold object at 0x03187698>]
ADDED: BulletRigidBodyNode S1 (1 shapes) mass=1 T:(pos -2.0112 0 0)
 BulletRigidBodyNode S2 (1 shapes) mass=1 T:(pos -3 0 0)

[<libpandabullet.BulletPersistentManifold object at 0x031878F0>]
[<libpandabullet.BulletPersistentManifold object at 0x03187698>]
[<libpandabullet.BulletPersistentManifold object at 0x031878F0>]
[<libpandabullet.BulletPersistentManifold object at 0x03187698>]
[<libpandabullet.BulletPersistentManifold object at 0x031878F0>]
[<libpandabullet.BulletPersistentManifold object at 0x03187698>]
ADDED: BulletRigidBodyNode S1 (1 shapes) mass=1 T:(pos -3.1344 0 0)
 BulletRigidBodyNode S2 (1 shapes) mass=1 T:(pos -3 0 0)

[<libpandabullet.BulletPersistentManifold object at 0x031876C8>]
[<libpandabullet.BulletPersistentManifold object at 0x03187698>]
[<libpandabullet.BulletPersistentManifold object at 0x031876C8>]
[<libpandabullet.BulletPersistentManifold object at 0x03187698>]
[<libpandabullet.BulletPersistentManifold object at 0x031876C8>]
[<libpandabullet.BulletPersistentManifold object at 0x03187698>]
[]
DESTROYED: BulletRigidBodyNode S1 (1 shapes) mass=1 T:(pos -4.4304 0 0)
 BulletRigidBodyNode S2 (1 shapes) mass=1 T:(pos -3 0 0)

DESTROYED: BulletRigidBodyNode S1 (1 shapes) mass=1 T:(pos -4.4304 0 0)
 BulletRigidBodyNode S2 (1 shapes) mass=1 T:(pos -3 0 0)

[]
[]
[]
[]

You see I get a persistent manifold point between the two objects (so the “world.getManifolds” way is working. Just keep in mind that a manifold is created as soon as their bounding boxes overlap. And I get collision events.