Trails

*เนื้อหานี้จะพร้อมใช้งานในภาษาที่คุณเลือกในเร็วๆ นี้

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.

  1. In the menu bar, navigate to the Model tab, then the Constraints section.

  2. If it's not currently enabled, toggle on Constraint Details.

    Constraint Details toggle indicated in Model tab

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:

  1. In the Explorer window, insert two Attachments and a Trail object into the part.

    1. Hover over the part and click the button. A contextual menu displays.

    2. From the menu, insert two Attachments and one Trail.

  2. Select the new Trail object and assign its attachments. Ensure you assign each attachment property to a different Attachment object.

    1. In the Properties window, select the Attachment0 property. Your cursor changes.
    2. In the Explorer window, select the first attachment you created.
    3. Back in the Properties window, select the Attachment1 property. Your cursor changes.
    4. In the Explorer window, select the second attachment you created.
  3. Using the Move tool, position both attachments within the part according to how wide you want the trail to be.

  4. 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.

  1. In the Explorer window, select the trail.

  2. In the Properties window, select the Color property. You can either:

    1. Click on the color square to open the Colors pop-up window and select a color.
    2. 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).

  1. In the Explorer window, select the trail.
  2. In the Properties window, select the Transparency property.
  3. 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.

Trail with lifetime of 0.5 (left) vs. trail with lifetime of 3.0 (right)

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.

TextureMode diagram with Wrap mode

When TextureMode is set to Enum.TextureMode.Stretch, the texture will repeat TextureLength times across the trail's overall length.

TextureMode diagram with Stretch mode

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.