bulletphysics / bullet3

Bullet Physics SDK: real-time collision detection and multi-physics simulation for VR, games, visual effects, robotics, machine learning etc.

Home Page:http://bulletphysics.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't retrieve mesh scale

domef opened this issue · 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)