As of version 3.7, there is a Ribbon class in the engine that lets you create beam and trail visual effects. Note that the code in 3.7 is slightly different to the version presented here, but the effect is the same.
Anatomy of a ribbon
These ribbons comprise several classes and components:
The Ribbon class represents the actual ribbon trail that you see on your screen. However, you'll never create a Ribbon directly in scripts - it's created automatically by the next class.
The ribbon node
The RibbonNode class acts as the 'head' of the ribbon. To create a ribbon, you must create a ribbon node, and tell it what ribbon to emit as its trail. RibbonNodes can be deactivated, and you can switch the ribbon trail datablock they use at any given time.
These two classes each have their own datablocks. RibbonData is the main datablock you'll use to edit ribbon settings, as it defines the visual appearance of the trail. RibbonNodeData has no settings, and simply exists because RibbonNode is a subclass of GameBase. You can just use the provided DefaultRibbonNodeData for all your ribbon nodes.
The Full template comes with a couple of materials and datablocks ready for you to use. They live in art/ribbons. (This is where DefaultRibbonNodeData is defined.)
Create ribbons from the editor
As of version 3.8, the scripts are set up so you can easily create ribbons from the editor to see their appearance. To do this, open the world editor, then select the library, open the FX folder, and double-click on either of the ribbons there. You can then drag the ribbon around in the world editor to see its behaviour.
Create ribbons from script
To create a ribbon in scripts, as described above, you must create an object of the RibbonNode class:
This will create an active ribbon node at coordinates (1, 2, 3). At any point after its creation, you can change the type of the ribbon by calling
or turn it off by calling
Most of the time, you'll want your ribbon to be mounted to some other object, like a weapon, projectile, or vehicle. To do that, you can use mountObject as you would any other mounted item:
You can see the result in this video. Enjoy!