Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Handles Three.js user interaction, including raycasting, object picking, mouse and touch input, and camera controls.
52% 65%+13 ptsof test cases passed
Passed 15 of 23 test cases with the skill, and 12 of 23 without it.
This test ran on v1. v2 is the current version and hasn’t been tested on gemini-3.6-flash yet.
3 of 3 safety checks passed
Not used yet
This file contains the detailed procedure and reference material extracted from
SKILL.mdfor focused loading. The root skill defines activation, examples, safety constraints, and limitations.
Pin the same Three.js version for core and addons. Snippets assume an existing renderer/camera/scene and are independent alternatives. Use canvas-relative coordinates for embedded scenes, update camera/projection and world matrices as needed, guard zero-sized canvases, and clean up all listeners/controls on teardown. Provide keyboard/focus and non-pointer alternatives; pointer lock needs an explicit user gesture and an exit path.
import * as THREE from "three";
import { OrbitControls } from "three/addons/controls/OrbitControls.js";
// Camera controls
const controls = new OrbitControls(camera, renderer.domElement);
controls.enableDamping = true;
// Raycasting for click detection
const raycaster = new THREE.Raycaster();
const mouse = new THREE.Vector2();
function onClick(event) {
const rect = renderer.domElement.getBoundingClientRect();
if (!rect.width || !rect.height) return;
mouse.x = ((event.clientX - rect.left) / rect.width) * 2 - 1;
mouse.y = -((event.clientY - rect.top) / rect.height) * 2 + 1;
raycaster.setFromCamera(mouse, camera);
const intersects = raycaster.intersectObjects(scene.children);
if (intersects.length > 0) {
console.log("Clicked:", intersects[0].object);
}
}
renderer.domElement.addEventListener("click", onClick);
Skills that do similar work, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.