bullet3 icon indicating copy to clipboard operation
bullet3 copied to clipboard

Can't retrieve mesh scale

Open domef opened this issue 6 months ago • 0 comments

I can retrieve translation and rotation from a mesh but I can't retrieve the scale.

import pybullet as pb
import trimesh

pb.connect(pb.DIRECT)

box = trimesh.creation.box(extents=[1.0, 1.0, 1.0])
box.export("/tmp/box.obj")
fileobj = "/tmp/box.obj"
translation = [1.5, -2.4, 5.0]
orientation = [0.5, 0.5, -0.5, 0.5]
scale = [1.0, 2.0, 3.0]
pb_obj = pb.createCollisionShape(
    shapeType=pb.GEOM_MESH, fileName=fileobj, meshScale=scale
)
pb_obj_id = pb.createMultiBody(
    baseCollisionShapeIndex=pb_obj,
    basePosition=translation,
    baseOrientation=orientation,
)
t, r = pb.getBasePositionAndOrientation(pb_obj_id)
s = pb.getCollisionShapeData(pb_obj_id, -1)[0][3]
print(t, r, s)

The output is:

(1.5, -2.4, 5.0) (0.5, 0.5, -0.5, 0.5) (1.0, 1.0, 1.0)

The expected output is:

(1.5, -2.4, 5.0) (0.5, 0.5, -0.5, 0.5) (1.0, 2.0, 3.0)

domef avatar Dec 20 '23 13:12 domef