enzed avatar

R3f Interaction

Handles all the interactive bits for React Three Fiber scenes. Pointer events work directly on mesh elements with onClick, onPointerOver, and friends, giving you intersection points, face normals, and UV coordinates out of the box. Includes camera controls from drei like OrbitControls, MapControls, and PointerLockControls, plus TransformControls for those editor-style gizmos. The event system is surprisingly clean, you can stopPropagation between overlapping objects and toggle raycasting per mesh. Covers the gap between "I have a 3D scene" and "users can actually interact with it" without writing your own raycasting logic. Great reference for event properties and control options you'll forget between projects.

skills.sh installs
3.4K
GitHub stars
135
last updated
Aug 21, 2026

Install

$ npx -y skills add enzed/r3f-skills --skill r3f-interaction --agent claude-code

Installs into .claude/skills of the current project.

Files

React Three Fiber interaction

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.

Selectable object

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 semantics

Sponsors

Details

Repository
github.com/enzed/r3f-skills
Categories
Frontend Development, Go, Design & UI/UX

More from enzed/r3f-skills

All 11
1freshtechbro avatarweb3d-integration-patternsfreshtechbro/claudedesignskillsMeta-skill for combining Three.js, GSAP ScrollTrigger, React Three Fiber, Motion, and React Spring for complex 3D web experiences. Use when building application3.4Kskills.sh installs
2markdown-viewer avatargraphvizmarkdown-viewer/skillsCreate directed/undirected graphs using DOT language with automatic layout. Best for dependency trees, call graphs, package hierarchies, and module relationship3.4Kskills.sh installs
3netlify avatarnetlify-image-cdnnetlify/context-and-toolsGuide for using Netlify Image CDN for image optimization and transformation. Use when serving optimized images, creating responsive image markup, setting up use3.3Kskills.sh installs
4tradermonty avatardowntrend-duration-analyzertradermonty/claude-trading-skillsAnalyze historical downtrend durations and generate interactive HTML histograms showing typical correction lengths by sector and market cap.3.3Kskills.sh installs
5ar9av avatarwiki-exportar9av/obsidian-wikiExport the Obsidian wiki's knowledge graph to structured formats for use in external tools. Use this skill when the user says "export wiki", "export graph", "ex3.3Kskills.sh installs
6microsoft avatarmemory-leak-auditmicrosoft/vscodeAudit code for memory leaks and disposable issues. Use when reviewing event listeners, DOM handlers, lifecycle callbacks, or fixing leak reports. Covers addDisp3.2Kskills.sh installs