Rotating Compound shapes

Mar 30, 2008 at 4:05 AM
Hey, I'm hoping someone might have seen this bug and either found a solution or has an idea of what may be wrong :)

I currently have a table (compound shape), a floor (just a group of static Box shapes), and a ball (Sphere shape) that you can throw from the camera. The table is made up of 5 shapes, one box shape and four cylinders as the legs. The table is set up to have very high linear damping, and very low angular damping.

Its hard to describe what is happening, but when you shoot a ball at the table and cause it to rotate, the cylinders quickly become out of sync with their graphical representations.
I am drawing each cylinder with the world transform of CollisionShape.WorldTransform * ((CompoundShape)CollisionShape).GetChildTransform(i);
It seems like the world transform of the child shapes is only being modified by the WorldTransform.Translation of the Compound shape, and not the rotation.
The top of the table (the Box shape) works perfectly though. The starting translation for that child shape is Vector3(0f,1.5f,0f). I'm not positive, but it seems like as long as the child shapes are only translated along the rotation axis (in the case of this table, it rotates around the Y axis), everything works. Once you translate or rotate along one of the other two axes, everything goes out of sync.

I'm confused that the shapes world transform multiplied by the child shapes transform is NOT the world transform of the child shape. This implies to me that either the world transform or the child shape transform is not the value actually being used in the calculations. I've looked through what I thought would be the likely areas in the code, and haven't been able to find anything.

I'm sorry for the disjointed post, but I'm really at a loss here. Any help whatsoever, even ideas about where to look in the code would be much appreciated.
Apr 13, 2008 at 7:33 AM
It sounds an awful lot like the shapes are being translated and then rotated. If that happens, everything will be fine as long as the translation is zero, but will get really screwed up with compounding errors when the translation goes non-zero.

I doubt that is the problem and I am sure you already looked at it, but it just sounds familiar to me in that way.

By the way, I am going to be working on BulletX for an XNA engine I have been writing. I was actually going to do my own port as I have previous experience with Bullet and the C4 engine, but I found this one and now I plan to just debug/improve this one and bring it up to the current Bullet release. I have been going through these few posts and documentation trying to get any information about the status of the port (other than what files have been ported) and you seem to have done the most work with it. I would love to chat with you about your experience and where you see improvements.
Apr 18, 2008 at 8:05 AM
FlashJackson - I'd also love to see BulletX improved and brought up to date with Bullet. In particular I'd like to see the various "Index out of range" exceptions (thrown some time after removing bodies from the world) fixed. I've heaps of ideas for BulletX-based projects but don't have enough time (or familiarity with Bullet's internals) to fix the fragile bits of the engine. If there's any way I can help you please let me know.

My main interest is in using BulletX with WPF and Silverlight. You can see some of my projects / demos at (or try direct at, among others).