# btRigidBody world transform and scale issue

When I create a collision shape for rigid body (in this case box) I use vertices positions and scale from the opengl matrix, the code looks this way:

glm::vec3 boxDim = getBoxDim(verticesPositions, scale);
collisionShape_.reset(new btBoxShape(btVector3(boxDim.x, boxDim.y, boxDim.z)));


When a simulation step is done I need to update opengl matrix for the object. I calculate a new model matrix this way:

btTransform transform = rigidBody->getWorldTransform();
float openglMatrix[16];
transform.getOpenGLMatrix(openglMatrix);

glm::mat4 newModelMatrix = glm::make_mat4(openglMatrix);
newModelMatrix = glm::scale(newModelMatrix, glTransform.getScale());


My code works but I wonder if there is any possibility to have already scale in the transform returned by getWorldTransform. Then I can ommit this line of the code:

newModelMatrix = glm::scale(newModelMatrix, glTransform.getScale());

• What's the reason you want to skip that line? Do you expect it to impact performance? – Bram Jan 1 at 23:20
• No, I just wonder if I use bullet api correctly. – Irbis Jan 2 at 19:10