Guides VFX & Particles Add Motion Trails

VFX & Particles 2 min read Updated Aug 2026

Add Motion Trails

Use `Trail Renderer` when a moving object needs a quick motion read: balls, dashes, projectiles, weapon arcs, pickups, or fast-moving 3D props.

Trail Renderer Example

Add the Component

  1. Select the moving GameObject.
  2. Choose Add Component -> 2D -> Rendering -> Trail Renderer for a 2D object, or Add Component -> 3D -> Rendering -> Trail Renderer for a 3D object.
  3. Press Play and move the object.

The trail samples the GameObject's world position while it moves and renders those points as one continuous ribbon. If the object is stationary, no new segment is added.

Shape the Trail

Trail Renderer Example

  • Time controls how long the trail remains visible.
  • Min Vertex Distance controls how far the object must move before a new point is added.
  • Start Width is the width near the object.
  • End Width is the width at the oldest end of the trail.
  • Start Color and End Color create the fade.
  • Emitting can pause new points without clearing the existing trail.
  • Auto Destruct can remove the owner after the trail has been stationary for the Time duration.

For a snappy arcade trail, start with:

Time: 0.35
Min Vertex Distance: 0.05
Start Width: 0.5
End Width: 0
Start Color: white, full alpha
End Color: cyan, zero alpha

Trail Renderer Example

Control It From PHP

use Lenga\Engine\Core\Behaviour;
use Lenga\Engine\Core\TrailRenderer;

final class DashTrail extends Behaviour
{
    private ?TrailRenderer $trail = null;

    public function start(): void
    {
        $this->trail = $this->getComponent(TrailRenderer::class);
        $this->trail?->clear();
    }

    public function beginDash(): void
    {
        $this->trail?->clear();
        if ($this->trail !== null) {
            $this->trail->emitting = true;
        }
    }

    public function endDash(): void
    {
        if ($this->trail !== null) {
            $this->trail->emitting = false;
        }
    }
}

2D and 3D Notes

In 2D scenes, trails use the component's sorting layer and order. In 3D scenes, Alignment decides whether the trail faces the camera or follows the transform orientation.

Use clear() after teleports, respawns, or scene resets so an old trail does not stretch across the screen.

API Reference