threejs-interaction

Implements Three.js raycasting, camera controls, and mouse/touch input for interactive 3D scenes.

Updated Apr 6, 2026
One-click install
npx skills add https://github.com/capella-hotel-group/capella-hotel-group-poc --skill threejs-interaction-capella-hotel-group
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: threejs-interaction
Source: https://github.com/capella-hotel-group/capella-hotel-group-poc/tree/main/.github/skills/threejs-interaction
Command: npx skills add https://github.com/capella-hotel-group/capella-hotel-group-poc --skill threejs-interaction-capella-hotel-group

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires three.

What problem does it solve? Building interactive 3D experiences requires wiring together raycasting, camera controls, and input handling, which involves repetitive boilerplate and subtle coordinate-conversion math that is easy to get wrong. ## Core Features & Use Cases - Raycasting & Picking: Click detection, hover effects, box selection, and touch support with efficient throttling and layer filtering. - Camera Controls: Ready-to-use patterns for OrbitControls, FlyControls, FirstPersonControls, PointerLockControls, TrackballControls, and MapControls. - Object Manipulation: TransformControls gizmos and DragControls for moving, rotating, and scaling objects, plus world-screen coordinate conversion. - Use Case: When building a product configurator where users click 3D parts to select them and orbit the camera around the model, use this Skill to implement the selection raycaster and damped OrbitControls correctly. ## Quick Start Add click detection and orbit camera controls to my Three.js scene so users can select meshes and rotate the view.

Frequently Asked Questions about threejs-interaction

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

FAQPage Schema
How do I detect clicks on 3D objects in Three.js?▼

Use THREE.Raycaster with setFromCamera after converting mouse coordinates to normalized device coordinates (-1 to 1). Call intersectObjects on your clickable meshes and read the first result for the closest hit object, point, and face data.

How to add orbit camera controls in Three.js?▼

Import OrbitControls from three/addons/controls/OrbitControls.js and instantiate it with your camera and renderer.domElement. Enable damping with controls.enableDamping = true and call controls.update() every animation frame for smooth movement.

Does Three.js raycasting work with touch input on mobile?▼

Yes, raycasting works with touch events by reading event.touches[0].clientX and clientY, then converting them to normalized device coordinates the same way as mouse input. Attach a touchstart listener to the renderer canvas and call preventDefault to avoid scrolling conflicts.

OrbitControls vs PointerLockControls, which should I use?▼

OrbitControls rotates the camera around a target point and suits model viewers and configurators. PointerLockControls hides the cursor for first-person navigation, making it the right choice for walkthroughs and FPS-style experiences.

Why is my Three.js raycast slow on mousemove?▼

Raycasting every mousemove against the full scene is expensive. Throttle handlers to around 20fps, restrict intersection tests to a list of clickable objects, use layers for filtering, and substitute invisible simple collision meshes for complex geometry.