threejs-interaction

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

1|Updated Aug 17, 2025
One-click install
npx skills add https://github.com/ratnesh-maurya/mdconverter --skill threejs-interaction-ratnesh-maurya
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: threejs-interaction
Source: https://github.com/ratnesh-maurya/mdconverter/tree/main/.claude/skills/threejs-interaction
Command: npx skills add https://github.com/ratnesh-maurya/mdconverter --skill threejs-interaction-ratnesh-maurya

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires three.

What problem does it solve? Building interactive 3D experiences requires wiring together raycasting, camera controls, and input events, which involves repetitive boilerplate and subtle coordinate-conversion math that is easy to get wrong. ## Core Features & Use Cases - Raycasting & Selection: Detect clicks, hovers, and touches on 3D objects, including box selection and efficient filtered raycasts. - Camera Controls: Configure OrbitControls, FlyControls, FirstPersonControls, PointerLockControls, TrackballControls, and MapControls with damping and limits. - Object Manipulation: Use TransformControls and DragControls to move, rotate, and scale objects directly in the scene. - Use Case: You are building a product configurator where users click parts of a 3D model to customize them. Use this Skill to set up click detection with raycasting, orbit camera controls, and hover highlight effects. ## Quick Start Add click detection and orbit camera 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 result'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 events on mobile?

Yes, raycasting works with touch input by reading event.touches[0].clientX and clientY, converting them to normalized device coordinates, and calling setFromCamera the same way as mouse events. Listen to touchstart on the renderer canvas.

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 simple invisible collision meshes for complex geometry.

How do I drag 3D objects with the mouse in Three.js?

Use DragControls from three/addons with an array of draggable meshes, camera, and renderer.domElement. Disable OrbitControls during dragstart and re-enable on dragend, and constrain positions in the drag event handler if needed.