def test_pso_create_shape(): ts1 = TransformState.makePos((1, 3, 5)) ts2 = TransformState.makePos((2, 4, 6)) par2 = (Vec3(4, 1, 7), ) obj0 = RBSO("0") obj1 = RBSO("1") obj2 = RBSO("2") obj0.set_shape("Box") obj1.set_shape(("Box", (), ts1)) obj2.set_shape(("Box", par2, ts2)) obj0.create_shape() obj1.create_shape() obj2.create_shape() sh0 = obj0.node().getShape(0) sh1 = obj1.node().getShape(0) sh2 = obj2.node().getShape(0) assert isinstance(sh0, BulletBoxShape) assert isinstance(sh1, BulletBoxShape) assert isinstance(sh2, BulletBoxShape) assert obj0.node().getShapeMat(0) == Mat4.identMat() assert obj1.node().getShapeMat(0) == ts1.getMat() assert obj2.node().getShapeMat(0) == ts2.getMat() assert sh0.getHalfExtentsWithMargin() == Vec3(0.5, 0.5, 0.5) assert sh1.getHalfExtentsWithMargin() == Vec3(0.5, 0.5, 0.5) assert sh2.getHalfExtentsWithMargin() == par2
def test_pso_delete_shape(): obj = RBSO("rso") obj.set_shape("Box") obj.create_shape() obj.delete_shape() assert obj.node().getNumShapes() == 0