A Trail is an object that creates a trail between and behind two Attachment objects as they move through space. Trails are useful to help players visualize movement, such as a sword slashing through the air, projectiles flying to their target, or footprints walking away.
After you create a trail, you can:
- Add a texture to create interesting visuals.
- Set a constant or gradient color and/or transparency.
- Modify a trail's lifetime.
- Specify the texture's length and mode to affect how it scales, repeats, and moves along with the trail's attachments.
Creating a Trail
Before you begin to create a trail, it's useful to toggle on visibility of attachments so you can more easily discern how their spacing affects the trail's width.
In the menu bar, navigate to the Model tab, then the Constraints section.
If it's not currently enabled, toggle on Constraint Details.
The following video demonstrates how attachments that are closer to each other create a trail with a smaller width:
To create a trail on a part:
In the Explorer window, insert two Attachments and a Trail object into the part.
Hover over the part and click the ⊕ button. A contextual menu displays.
From the menu, insert two Attachments and one Trail.
Select the new Trail object and assign its attachments. Ensure you assign each attachment property to a different Attachment object.
- In the Properties window, select the Attachment0 property. Your cursor changes.
- In the Explorer window, select the first attachment you created.
- Back in the Properties window, select the Attachment1 property. Your cursor changes.
- In the Explorer window, select the second attachment you created.
Using the Move tool, position both attachments within the part according to how wide you want the trail to be.
To see the trail, move the part in any direction and the trail follows.
Customizing Trails
By experimenting with the following properties, you can customize a trail's visual appearance to make unique gameplay elements like wind gusts, sword slashes, and tire marks from fast cars.
Texture
The Texture property renders a texture across the length of the trail. You can set a trail's Texture property to any asset ID. For more information, including how to add or import your own textures, see Importing Assets.
Color
The Color property tints the trail's texture to either a specific hue or a ColorSequence. The video below shows how a constant color compares with a gradient color across the trail's lifetime.
In the Explorer window, select the trail.
In the Properties window, select the Color property. You can either:
- Click on the color square to open the Colors pop-up window and select a color.
- Input three numbers into the RGB color value field.
Transparency
The Transparency property sets the transparency of the trail's segments over its Lifetime. It can be a consistent value or a NumberSequence with ranges from 0 (totally opaque) to 1 (fully clear).
- In the Explorer window, select the trail.
- In the Properties window, select the Transparency property.
- Input the desired opacity for the trail.
Lifetime
The Lifetime property allows you to set the duration of the trail in seconds. When you decrease the value of this property, the trail moves through the space more quickly and consequently cuts down the length of the trail. This can provide the object with a faster, more animated visual appearance.
Texture Length/Mode
A trail's TextureLength and TextureMode determine how its texture scales, repeats, and moves along with the trail's attachments.
When TextureMode is set to Enum.TextureMode.Wrap or Enum.TextureMode.Static, the TextureLength property sets the length of the texture as it repeats across the trail's length.
When TextureMode is set to Enum.TextureMode.Stretch, the texture will repeat TextureLength times across the trail's overall length.
Facing
A trail is a 2D projection existing in 3D space, meaning that it may not be visible from every angle. The FaceCamera property, when set to true, ensures that the trail always faces the CurrentCamera, regardless of its orientation.