Attachments allow you to change a vehicle visually without wasting memory for an entire new .CGA. If you ever need to make a variation of a an existing vehicle, for example by putting a hilarious wing on the rear, you can use attachments to save on mesh memory.
Coincidentally, I start to think that the vehicle used for this documentation is looking a little bland, so lets go ahead and put a wing on it, using attachments.
First of all, we need to create a dummy in our DCC tool and position it where we want our wing to be later on and link it to the "body" node.
We also need a normal and a _damaged version of the wing we'd like to put on the vehicle.
These assets are exported as separate .CGFs and in order to get them on our vehicle, we need to define the dummy we added to the vehicle as a subpart of the "body" part.
Here's how the "wing_attachement" part is built up:
Just like our "body" part, the attachment part has a "filename" and a "filenameDestroyed" property and just like any other part, the attachment will switch to the _damaged variation defined in the XML once the vehicle is destroyed.
The live version of our vehicle, with it's new, fancy rear wing:
After destroying the vehicle the wing switched to it's damaged version. The amount of downforce generated by the wing is now reduced significantly.