I was using btDefaultMotionState, and as my center of mass wasn't at the origin of the graphics object I gave it a center of mass offset. But that started giving me some weird results with the collision shape and the geometry becoming separated when there was some rotation.
Looking at the code for getWorldTransform and setWorldTransform I notice something weird. getWorldTransform says:
Code: Select all
massTransform = offset^-1 * graphicsTransform
Code: Select all
massTransform = offset^-1 * graphicsTransform
offset * massTransform = offset * offset^-1 * graphicsTransform
offset * massTransform = graphicsTransform
graphicsTransform = offset * massTransform
Code: Select all
graphicsTransform = massTransform * offset
I fixed my problem by implementing my own motion state subclass, but I would like to know if this is a bug in the code or in my understanding.
---JvdL---