Skip to content
Back to skills

Weapon Trail

ASecurity

Create a ribbon trail effect that follows a weapon's movement.

  • 31 stars
  • 0 votes
  • 0 copies
  • 5 views
  • Added May 27, 2026
developmentgit

Security analysis

A100/100

Scanned May 27, 2026

npx -y skills add verekia/r3f-gamedev --skill weapon-trail --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Weapon Trail?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Weapon Trail
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/verekia-weapon-trail/badge)](https://www.skillsdirectory.com/skills/verekia-weapon-trail)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: weapon-trail
description: Create a ribbon trail effect that follows a weapon's movement.
---

# Weapon Trail

Create a ribbon trail effect that follows a weapon's movement.

## Technique

Build a custom `BufferGeometry` that stores a history of positions in a ring buffer. Each frame, record the current world positions of trail points and update the geometry vertices to create a ribbon connecting all historical positions.

## Key Concepts

- Define trail points (e.g., base and tip of weapon)
- Use a ring buffer to store position history efficiently
- Create geometry with proper UVs for texture mapping (gradient fade)
- Update vertex positions each frame with `positions.needsUpdate = true`
- Use `localToWorld()` to get world positions from the target object
- Support enabling/disabling with fade out animation

## Usage

```tsx
const trailPoints = [new Vector3(0, 0, 0), new Vector3(0, 1.5, 0)]

<group ref={weaponRef}>
  <mesh>{/* weapon mesh */}</mesh>
</group>
<Trail target={weaponRef} points={trailPoints} enabled={isAttacking} />
```

## Geometry Structure

- Segments: historical snapshots (oldest to newest)
- Points per segment: trail point positions at that time
- UVs: u = position along trail (0-1), v = age (0 = newest, 1 = oldest)
- Alpha map texture for gradient fade effect

---

This skill is part of [verekia](https://x.com/verekia)'s [**r3f-gamedev**](https://github.com/verekia/r3f-gamedev).

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.