Seeing this kind of functionality in game is the end result of a lot of parts that all have to work together perfectly. I created the model in Softimage, and constrained groups of rigid body shapes to the various bones. Each group of shapes corresponds to physics primitives such as spheres, boxes, etc and are combined into a single rigid body. When the asset is exported, it combines this information with everything else (geometry, skeletons, animations, textures, shaders, etc) which is processed by the content pipeline tools into something the game code can load. Once loaded, the game code does the work of setting up the binding all the physics data with the animated model data.
While the turret is in it's healthy state (before being destroyed) it is animated using an "animation tree" system which provides fairly high level control of the visual. For this model, that means the tree has a node which is set up to aim the gun, another to spin the barrel when it shoots, and another to enable a light and secondary flash mesh attached to the end of the barrel when it actually fires a projectile.
|The turret model in wireframe, with the rigid body parts as solids.|
All of the assets for the turret are assembled in Softimage and the pipeline takes care of the rest. This content creation system is used for everything in the game and while it was a pretty big time investment to make it work, it was well worth the effort. There is a lot to be said for automation and I am expecting this and all subsequent projects will benefit from streamlining the creation and use of assets. It's pretty handy to be able to just hit export, include the asset in the package and in the game code just load it up and use it without messing around with manually hooking up shaders, textures, animations and all the rest. The simplest use case is literally a few lines of code to load, initialize and add to the scene which lets me get right on to making the actor do something interesting for the gameplay.