Implements React Three Fiber pointer events, picking, dragging, keyboard input, and camera controls. Covers event semantics, raycasting, pointer capture, and control ownership for scene interaction.
Ships in enzed-r3f-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Check installed Fiber, Drei, and input-library versions first. Examples target Fiber 9 / React 19. Choose camera movement, object movement, and UI input owners before connecting handlers.
Mount beneath Canvas. Keep accessible DOM controls outside Canvas for important actions; mesh pointer handlers alone do not provide keyboard access.
import { useState } from 'react'
import { OrbitControls } from '@react-three/drei'
export default function Example() {
const [selected, setSelected] = useState(false)
return (
<>
<mesh
name="selectable-box"
onClick={(event) => {
event.stopPropagation()
setSelected((value) => !value)
}}
>
<boxGeometry />
<meshStandardMaterial color={selected ? 'gold' : 'coral'} />
</mesh>
<OrbitControls makeDefault />
</>
)
}
event.object is the hit object; event.eventObject is the object owning the handler.stopPropagation() blocks delivery to farther hits as well as ancestors. It changes event delivery; it does not avoid raycasts already performed. Calling it can immediately trigger pointerout on previously hovered objects behind the hit.event.point is world space. Clone values you retain and convert into the parent's local space before assigning local transforms. A plane intersection or depth reference is needed to map a 2D drag into 3D.onPointerMissed for background deselection; distinguish clicks from drags using the event's movement information and the application's gesture policy.event.target.setPointerCapture(event.pointerId) and the matching release method; also handle cancellation/lost capture.state.events.update() to refresh hover results. Call it only when needed, not as a blanket extra raycast every frame.makeDefault exposes a controls instance to helpers that coordinate with it. TransformControls can suspend default controls while dragging; verify that custom controls are also disabled/restored correctly.client coordinates can introduce offsets.useFrame for movement; subscribe only for discrete events and clean up subscriptions.useScroll belongs below it. Its normalized offset/delta are not pixel distances.Test overlapping meshes, nested groups, background deselection, dragging outside the canvas, touch, cancellation, focus loss, and keyboard alternatives. Verify camera controls recover after dragging.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
r3f, three-js, 3d-interaction, pointer-events, camera-controls
/enzed-r3f-skills:r3f-interactionfrom enzed-r3f-skills
enzed-r3f-skills@cascade-code-languages-misc-1 is listed by joshuarweaver/cascade-code-languages-misc-1 — review the source before installing
npx claudepluginhub joshuarweaver/cascade-code-languages-misc-1 --plugin enzed-r3f-skills11 skills in this plugin
/r3f-animationAnimate React Three Fiber objects with useFrame, damping, and GLTF clips. Use for procedural motion, animation transitions, or demand-loop animation; use physics guidance for collision-driven movement./r3f-fundamentalsSet up React Three Fiber scenes, Canvas, typed JSX, hooks, and resource ownership. Use for scene architecture and render-loop setup, rather than detailed materials or effects./r3f-geometryBuild React Three Fiber geometry, custom buffers, instanced meshes, points, and lines. Use for shape construction and geometry draw-call optimization, rather than material appearance./r3f-lightingLight React Three Fiber scenes with direct lights, environment maps, and shadows. Use for light placement, image-based lighting, shadow artifacts, and lighting performance./r3f-loadersLoad and reuse 3D assets in React Three Fiber with useGLTF, useLoader, Suspense, and preloading. Use for model loading, decoder setup, caching, cloning, or loading/error UI./r3f-materialsChoose and configure React Three Fiber surface materials, PBR, transparency, and transmission. Use for mesh appearance and material cost; use shader guidance for custom GLSL or TSL code.Other plugins' skills for the same job