threejs-interaction

Implement pointer-driven raycasting interactions for Three.js scenes.

Updated May 18, 2026
One-click install
npx skills add https://github.com/yogaprasetya22/mmorpg --skill threejs-interaction-yogaprasetya22
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: threejs-interaction
Source: https://github.com/yogaprasetya22/mmorpg/tree/main/frontend/.agents/skills/threejs-interaction
Command: npx skills add https://github.com/yogaprasetya22/mmorpg --skill threejs-interaction-yogaprasetya22

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It solves the challenge of turning a Three.js 3D scene into an interactive UI by mapping mouse/touch input to objects, camera controls, and selectable/hoverable elements.

Core Features & Use Cases

  • Raycasting-based object picking: Detect which 3D object the user points at to support click selection, hover feedback, and interaction routing.
  • Camera controls integration: Add common control schemes like OrbitControls, FlyControls, FirstPersonControls, PointerLockControls, MapControls, and more to enable navigation.
  • Coordinate conversion utilities: Convert between world and screen coordinates to position HTML overlays or translate user input into 3D positions.
  • Selection and input event patterns: Implement practical event handling for click/hover selection, box selection, and keyboard state updates for interaction-driven gameplay.

Quick Start

Build object selection by creating a Raycaster, converting pointer coordinates to normalized device coordinates, raycasting from the camera, and handling the first intersection from your scene.

Frequently Asked Questions about threejs-interaction

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

FAQPage Schema
How do I use raycasting in Three.js to detect clicked 3D objects?

Raycasting in Three.js detects clicked 3D objects by converting pointer coordinates to normalized device coordinates, casting a ray from the camera, and evaluating intersections against your scene's targeted object lists.

How do I add OrbitControls to a Three.js scene for camera navigation?

You add OrbitControls by integrating Three.js control add-ons into your scene, enabling pointer-driven camera navigation schemes that let users rotate, pan, and zoom within interactive 3D web experiences.

How do I convert world coordinates to screen coordinates in Three.js?

Converting world coordinates to screen coordinates in Three.js translates 3D positional data into 2D viewport space, allowing you to accurately position HTML overlays or map user input to 3D positions.

Can I use Three.js PointerLockControls for first person interaction?

Yes, Three.js supports PointerLockControls to implement first person interaction, allowing you to integrate mouse-driven looking and keyboard state updates for interaction-driven gameplay and navigation.

How do I handle mouse input for hover selection in a 3D scene?

Handling mouse input for hover selection in a 3D scene requires setting up a Raycaster with normalized mouse coordinates, firing rays on pointer move events, and routing interaction feedback to the intersected object.

What is the best way to optimize Three.js raycasting performance?

Optimizing Three.js raycasting performance involves filtering intersectable objects using layers or targeted object lists, reducing the number of meshes evaluated during pointer move events and click detection.