threejs-interaction

Implement raycasting, camera controls, and mouse/touch input handling for interactive Three.js scenes.

Updated Jul 16, 2026
One-click install
npx skills add https://github.com/X-manist/Cohmira --skill threejs-interaction-x-manist
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: threejs-interaction
Source: https://github.com/X-manist/Cohmira/tree/main/src/builtin-plugins/openmontage/.agents/skills/threejs-interaction
Command: npx skills add https://github.com/X-manist/Cohmira --skill threejs-interaction-x-manist

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires three.

What problem does it solve? Building interactive 3D experiences requires wiring together raycasting for object picking, camera control schemes, and pointer event handling, which involves repetitive boilerplate and subtle coordinate conversion math that is easy to get wrong. ## Core Features & Use Cases - Raycasting & Picking: Convert mouse/touch positions to normalized device coordinates, detect clicked or hovered objects, and filter targets with layers and thresholds. - Camera Controls: Configure OrbitControls, FlyControls, FirstPersonControls, PointerLockControls, TrackballControls, and MapControls with damping, limits, and auto-rotation. - Object Manipulation: Attach TransformControls gizmos for translate/rotate/scale, DragControls for direct dragging, and SelectionBox for box selection. - Use Case: When building a 3D product configurator, use this Skill to add click-to-select highlighting on meshes, orbit camera navigation with zoom limits, and hover effects that change the cursor and object color. ## Quick Start Add click detection and OrbitControls with damping to my Three.js scene so users can rotate the camera and select objects by clicking them.

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 the mouse position to normalized device coordinates ranging from -1 to 1. Call intersectObjects on your clickable meshes and read the first entry of the returned array for the closest hit.

How to add orbit camera controls in Three.js?

Import OrbitControls from three/addons/controls/OrbitControls.js and construct it with your camera and renderer.domElement. Enable damping with controls.enableDamping = true and call controls.update() every 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 and converting them the same way as mouse coordinates. Listen for touchstart on 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 scene inspection. PointerLockControls hides the cursor for first-person navigation and suits games or walkthroughs where WASD movement is needed.

Why is my Three.js raycast slow on mousemove?

Raycasting every mousemove against the whole 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.