I am confused that how shall I get collide messages such as “Cube1 collide with Cube2” or store in a boolean cube1_collide_with_cube2 in BulletWorld. I’ve no idea 'cos it’s not like collides in normal Panda, I don’t know if it will use Bitmask or something like travaser. Please help, thx!!
Codes at here:
#here creates the volleyball court
self.feild = loader.loadModel(f"{MODEL_PATH_PREFIX}court/court.egg")
mesh = BulletTriangleMesh()
for geom_np in self.feild.findAllMatches('**/+GeomNode'):
geom_node = geom_np.node()
ts = geom_node.getTransform()
for geom in geom_node.getGeoms():
mesh.addGeom(geom, True, ts)
shape = BulletTriangleMeshShape(mesh, dynamic = False)
self.floor = self.worldNP.attachNewNode(BulletRigidBodyNode('court'))
self.floor.node().addShape(shape)
self.floor.setPos(0, 0, 0)
self.floor_bitmask = BitMask32.allOn()
self.floor.setCollideMask(self.floor_bitmask)
self.world.attachRigidBody(self.floor.node())
self.feild.reparentTo(self.floor)
self.feild.setScale(39.4, 39.4, 39.4)
self.feild.setPos(-0.16, 175.7, 270)
#here creates the character
self.gawgura = loader.loadModel(f"{MODEL_PATH_PREFIX}gawgura/gawgura.egg")
shape = BulletCapsuleShape(0.3, 1.7, True)
self.gawgura_entity = self.worldNP.attachNewNode(BulletRigidBodyNode('gawgura'))
self.gawgura_entity.node().addShape(shape)
self.gawgura_entity.node().setMass(1)
self.gawgura_entity.setPos(100, 0, 70)
self.gawgura_entity.setHpr(0, 90, 0)
self.gawgura_entity.setScale(35,35,35)
self.gawgura_bitmask = BitMask32.allOn()
self.gawgura_entity.setCollideMask(self.gawgura_bitmask)
self.world.attachRigidBody(self.gawgura_entity.node())
self.gawgura.reparentTo(self.gawgura_entity)
self.gawgura.setScale(1, 1, 1)
self.gawgura.setHpr(0, -90, 0)
self.gawgura.setPos(0, -1, 0)
When the character drop down to the court, it do stop and keep static, but I have no idea how can I get the message “The character has touched the floor”.
thx for advance