vtj-component-model

Create singleton-based 3D components with lifecycle methods for Vue 3 Three.js scenes.

175|39|Updated Dec 13, 2025
One-click install
npx skills add https://github.com/hexianWeb/Third-Person-MC --skill vtj-component-model
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: vtj-component-model
Source: https://github.com/hexianWeb/Third-Person-MC/tree/main/.cursor/skills/vtj-component-model
Command: npx skills add https://github.com/hexianWeb/Third-Person-MC --skill vtj-component-model

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

The vtj-component-model provides a clear, reusable pattern for creating 3D components in Three.js by using a class-based singleton tied to the Experience manager. It reduces boilerplate, enforces standardized lifecycle methods, and ensures proper resource cleanup across components.

Core Features & Use Cases

  • Singleton Experience integration: Components access shared resources via a central Experience singleton.
  • Standard lifecycle: Implement _init, update, resize, and destroy to manage objects and resources in the scene.
  • Reusable templates: Build new 3D objects, managers, or controllers by extending the base pattern when wiring into src/js/.
  • Use Case: Create a new 3D object component that automatically registers with the scene, updates per frame, and properly disposes of its geometry and materials on destroy.

Quick Start

  • Create a new component file in src/js/ and extend the provided pattern.
  • Import Experience, set up dependencies with this.experience = new Experience(), and implement lifecycle methods.
  • Instantiate the component in your scene setup and ensure destroy() cleans up resources.

Frequently Asked Questions about vtj-component-model

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure 3D components in Three.js to ensure proper resource cleanup?

Structure 3D components using a class-based singleton pattern linked to the Experience instance. This enforces standardized lifecycle methods including init, update, resize, and destroy to ensure safe resource disposal and proper cleanup.

What is the best way to manage shared resources across multiple Three.js components?

Manage shared resources across Three.js components by accessing them via a central Experience singleton. This singleton integration provides a clear, reusable pattern that reduces boilerplate while maintaining consistent lifecycle management across components.

How to create a Three.js component that automatically registers with the scene and updates per frame?

Create a Three.js component by extending the provided base pattern in your src/js/ directory. Import Experience, set up dependencies with this.experience = new Experience(), and implement lifecycle methods to register and update per frame.

Does this 3D component pattern work with Vue 3 and Three.js projects?

Yes, this singleton pattern works specifically with Vue 3 and Three.js projects. It applies to creating new components, managers, or utilities that interact with the Three.js scene, ensuring consistent lifecycle and cleanup within that environment.

Why should I use a singleton pattern for Three.js scene management?

Use a singleton pattern for Three.js scene management to reduce boilerplate scaffolding and enforce standardized lifecycle methods. It ensures proper resource cleanup by providing a clear, reusable structure tied to a central Experience manager.

When do I need to implement the destroy method in a Three.js component?

Implement the destroy method in a Three.js component whenever you need to clean up resources. It ensures safe disposal of geometry and materials, preventing memory leaks when the component is removed from the scene.