def genBulletCDBoxes(obstaclecmlist, name='autogen'): """ generate a bullet cd obj using a list of AABB boxes generated from obstaclenplist :param obstaclenplist: the AABB box of each obstaclenp in the list will be computed and used for cd :return: bulletrigidbody author: weiwei date: 20180807, osaka """ bulletboxesnode = BulletRigidBodyNode(name) for obstaclecm in obstaclecmlist: if obstaclecm.type is not "box": raise Exception("The type of obstaclecms must be box!") cdsolid = obstaclecm.cdcn.getSolid(0) bulletboxshape = BulletBoxShape.makeFromSolid(cdsolid) bulletboxesnode.addShape( bulletboxshape, TransformState.makeMat3( obstaclecm.getMat().getUpper3()).setPos(obstaclecm.getPos() + cdsolid.getCenter())) return bulletboxesnode
def genBulletCDBoxes(obstaclecmlist, name='autogen'): """ generate a bullet cd obj using the AABB boundaries stored in obstacle collision models :param obstaclecmlist: a list of collision models (cmshare doesnt work!) :return: bulletrigidbody author: weiwei date: 20190313, toyonaka """ bulletboxesnode = BulletRigidBodyNode(name) for obstaclecm in obstaclecmlist: if obstaclecm.type is not "box": raise Exception( "Wrong obstaclecm type! Box is required to genBulletCDBox.") cdsolid = obstaclecm.cdcn.getSolid(0) bulletboxshape = BulletBoxShape.makeFromSolid(cdsolid) bulletboxesnode.addShape( bulletboxshape, TransformState.makeMat3( obstaclecm.getMat().getUpper3()).setPos(obstaclecm.getPos() + cdsolid.getCenter())) return bulletboxesnode