threejs-interaction

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

Updated Sep 1, 2026
One-click install
npx skills add https://github.com/zamansepeti43/c-rak-agent --skill threejs-interaction-zamansepeti43
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: threejs-interaction
Source: https://github.com/zamansepeti43/c-rak-agent/tree/main/video-engine/.agents/skills/threejs-interaction
Command: npx skills add https://github.com/zamansepeti43/c-rak-agent --skill threejs-interaction-zamansepeti43

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, and input handling, which involves repetitive boilerplate and subtle coordinate-conversion bugs. ## Core Features & Use Cases - Raycasting & Picking: Click detection, hover effects, box selection, and touch support with efficient throttled raycasts 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 3D product configurator, use this Skill to add click-to-select meshes, orbit camera navigation with damping, and drag-and-drop object placement. ## Quick Start Add click detection and orbit controls to my Three.js scene so users can select and inspect 3D objects.

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 intersection's object, point, and distance properties.

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 animation frame.

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

Yes, raycasting works with touch events by reading event.touches[0].clientX and clientY, converting them to normalized coordinates, and calling setFromCamera. Attach handlers to touchstart on the renderer canvas and call preventDefault to avoid scrolling.

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 checks to a list of clickable objects, use layers for filtering, and substitute simple invisible collision meshes for complex geometry.

How do I drag objects in a Three.js scene?

Use DragControls from three/addons with an array of draggable meshes, camera, and canvas. Listen to dragstart, drag, and dragend events to disable OrbitControls while dragging and constrain positions, such as locking movement to the ground plane.