Ghosting Trails

High-Speed Phantom Effects

  1. 👻 After-Image Generation
    1. 📈 How it Works
  2. 💻 API Usage
    1. One-Shot Sequence
    2. Sustained Ghosting
  3. ⚙️ Advanced Settings
  4. 🧩 Advanced Use Cases
    1. Performance-First Ghosting

👻 After-Image Generation

Ghosting trails (often called “Phantoms” or “After-Images”) are essential for highlighting fast player movement, dashes, or special attacks.

📈 How it Works

  1. Mesh Snapshot: When an object moves fast enough, the system takes a “Snapshot” of the current mesh/sprite and its position.
  2. Pooling: These snapshots are pooled (recycled) to prevent memory allocation during action.
  3. Fading: Each ghost fades out based on a custom alpha curve.

💻 API Usage

One-Shot Sequence

Triggers a burst of ghosts for a single dash action.

Juice.Ghosting.Spawn(targetObject, 5, 0.05f); // 5 ghosts, every 0.05 seconds

Sustained Ghosting

Enable for a duration (e.g., during “Power-Up” mode).

Juice.Ghosting.Enable(targetObject, 2.0f); // Spawn ghosts for 2 seconds

⚙️ Advanced Settings

Field Description
Material Overlay The material used for the ghost (usually a transparent additive shader).
Fade Speed How quickly each ghost disappears.
Spawn Delay Time between each ghost snapshot.

🧩 Advanced Use Cases

Performance-First Ghosting

The GhostingModule is optimized for high-density scenarios. Unlike standard Unity trails, it does not use a TrailRenderer, but instead draws a fixed set of meshes. This keeps your draw calls and vertex count predictable.

[!TIP] Pro Tip: Use ghosting for characters moving at high velocity to give them a sense of extreme speed and power!


This site uses Just the Docs, a documentation theme for Jekyll.