Having done a system exactly like this. It's basically am ordering issue as you seem to have most of the pieces in place. The part you need to do though is understand their is another multiplication you need to do and that's the attachment point.
Will do this as a basic step process for now.
- Create a world transform for model x. Scale rotate translate.
- In local model space. Create a matrix translation for your attachment point for your child object. Multiply this with your x transform to get where your child would be in world space.
- Create a scale rotate transform for the model in ITS local space. Should be the identity matrix most likely. But if its a tank turret then its the rotarion matrix.
- Multiply child model matrix by the attachment matrix.
- Repeat 3 and 4 for every subsequent child.
The use of this technique is not limited to the model rendering but also for things such as particle attachment points and barrel ejection points on guns etc.
You can reference the game here. There is a tank that has articulated turrets, Anti aircraft battery that rotates on its base, and planes with articulated propellers. The bullet ejection points are accurate and as depicted in screenshot below.