threejs-interaction covers how a three.js scene responds to mouse, touch, pen and keyboard input. It starts with a runnable example that combines OrbitControls with a Raycaster to detect clicks on a mesh, using pointer events and canvas-relative coordinates.
The topics cover picking objects, camera controls, transform gizmos, dragging, hover effects and box selection, and they behave the same under WebGL and WebGPU.
What You Get
- A runnable example combining OrbitControls and a Raycaster
- Pointer-to-canvas coordinate handling that works when a page scrolls or embeds the canvas
- Guidance on using pointer events to cover mouse, touch and pen
- Coverage of transform gizmos, dragging, hover and box selection
- A WebGPU and TSL section and a list of common mistakes
Common Use Cases
- Detecting clicks on a 3D object
- Adding orbit, pan and zoom camera controls
- Highlighting objects on hover
- Letting users drag or transform objects in a scene
- Selecting several objects with a box
What Makes It Unique
Its coordinate handling is computed from the canvas rectangle, so it works in scrolled and embedded layouts, and its quick start runs the controls with the Timer delta. It is one of thirteen skills pinned to r186 that share a layout and link to each other.
Under The Hood
The skill is a single SKILL.md of explanation and JavaScript examples, with no scripts, and it tells the agent to run no commands. The agent reads it and writes three.js code into your project. It fetches nothing and writes no files itself.