Skip to content
enzed avatar

R3f Interaction

React Three Fiber input handling covering pointer picking, drag ownership, camera controls, and keyboard movement.

CCM score
68 of 100
skills.sh installs
3.6K
GitHub stars
138
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers pointer events, hit testing, bubbling, pointer capture, and camera or object drag ownership for 3D scenes
  • Includes guidance on stopPropagation, event.point world-space conversion, setPointerCapture, and KeyboardControls for movement
  • Enforces restoring camera controls after drags and clearing held input on focus loss, with keyboard alternatives for important actions
  • Designed for React Three Fiber 9 and React 19 projects with Drei controls, not for animation or physics simulation itself

Install

$ npx -y skills add enzed/r3f-skills --skill r3f-interaction -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

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

Details

Repository
github.com/enzed/r3f-skills
Categories
3D, CAD & Modeling, Frontend & UI Code

More from enzed/r3f-skills

All 11

Similar to R3f Interaction

More 3D, CAD & Modeling