Rotating A Static GImpactMeshShape [SOLVED]

kristianbauer
Posts: 2
Joined: Mon Jul 20, 2009 10:06 pm

Rotating A Static GImpactMeshShape [SOLVED]

Post by kristianbauer »

I am able to load in a mesh, display it properly, and when mass is applied it interacts with the other objects just fine. However, when I load it in with no mass and try to apply a rotation via btQuaternion and btTransform, it doesn't affect the mesh at all.

First I create a btQuaternion and apply the rotation I want via the setEuler function.
I then create the btGImpactMeshShape, setLocalScaling, setMargin, and updateBound.
Then comes the btTransform where I setIdentity, setRotation, and setOrigin.
Finally I create the btDefaultMotionState and the btRigidBody with the btRigidBodyConstructionInfo.

I can't figure out where I'm going wrong. It works with every other shape I try to make except the btGImpactMeshShape. Any assistance is much appreciated.
kristianbauer
Posts: 2
Joined: Mon Jul 20, 2009 10:06 pm

Re: Rotating A Static GImpactMeshShape [SOLVED]

Post by kristianbauer »

After loading the mesh in as done above, I changed the center of mass using setCenterOfMassTransform. When you pass in a btTransform with the correct rotation that you want for the mesh shape, the mesh shape rotates properly.

Edit:
Of course, this only really works for static objects. It's kind of a hack, too, because you're changing the center of mass and not the meshShape itself.