threejs-interaction

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

Updated Aug 12, 2026
One-click install
npx skills add https://github.com/brunoolf/frontend-craft --skill threejs-interaction-brunoolf
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: threejs-interaction
Source: https://github.com/brunoolf/frontend-craft/tree/main/skills/threejs-interaction
Command: npx skills add https://github.com/brunoolf/frontend-craft --skill threejs-interaction-brunoolf

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires three.

What problem does it solve? Building interactive 3D experiences in Three.js requires wiring together raycasting, camera controls, pointer events, and coordinate conversions, which is error-prone and repetitive without a reference implementation. ## Core Features & Use Cases - Raycasting and Picking: Click detection, hover effects, box selection, and touch support with efficient throttled raycast patterns. - Camera Controls: Ready-to-use configurations for OrbitControls, FlyControls, FirstPersonControls, PointerLockControls, TrackballControls, and MapControls. - Object Manipulation: TransformControls gizmos and DragControls for moving, rotating, and scaling objects, plus world-to-screen coordinate conversion for HTML overlays. - Use Case: You are building a product configurator where users click 3D parts to select them, orbit the camera around the model, and drag components into place — this Skill provides the complete interaction layer. ## Quick Start Ask the AI to add click detection and orbit camera controls to your Three.js scene using the threejs-interaction patterns.

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() each 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 handlers to touchstart on the renderer canvas.

OrbitControls vs PointerLockControls, which should I use?▼

OrbitControls rotates the camera around a target point, ideal for model viewers and configurators. PointerLockControls provides first-person mouse-look for games and walkthroughs, requiring manual WASD movement logic.

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

Raycasting every mousemove event against the whole scene is expensive. Throttle handlers to around 20fps, restrict intersection checks to a list of clickable objects, and use layers or simplified invisible collision meshes.

How do I position an HTML element over a 3D object?▼

Clone the object's world position, call vector.project(camera), then map the result from normalized coordinates to pixel coordinates using window dimensions. Update the element's left and top styles each frame.