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_boxshape_fix_xform(): # _fix_xform ident_T = TransformState.makeIdentity() X = None assert BoxShape._fix_xform(X) == ident_T X = () assert BoxShape._fix_xform(X) == ident_T X = Mat4.identMat() * 3 assert BoxShape._fix_xform(X) == TransformState.makeMat(X)