Act as an expert React, TypeScript, and React Three Fiber (R3F) developer. Create a…
- User
Act as an expert React, TypeScript, and React Three Fiber (R3F) developer. Create a production-ready, fully modular, and reusable R3F component asset for: [INSERT ASSET DESCRIPTION HERE, e.g., an interactive holographic sci-fi button, a procedurally swaying palm tree, or a glTF model viewer with hover states].
Requirements & Best Practices:
-
Component Architecture:
- Write the component in TypeScript with a strictly typed Props interface extending or including standard group/mesh props (e.g.,
JSX.IntrinsicElements['group']). - Keep the component completely self-contained and drop-in ready for any R3F .
- Write the component in TypeScript with a strictly typed Props interface extending or including standard group/mesh props (e.g.,
-
Animation & Interactivity:
- Use
@react-three/fiber'suseFramehook for animations, utilizing delta time (delta) for frame-rate independence. - Use
@react-three/dreihelpers where appropriate (e.g.,useGLTF,Center,Html,MeshTransmissionMaterial). - Implement clean event handlers (e.g.,
onPointerOver,onPointerOut,onClick) with proper state management for hover/active visual feedback.
- Use
-
Performance & Reliability:
- Ensure geometries and materials are properly memoized or loaded safely to prevent memory leaks and unnecessary re-renders.
- If loading external assets (like textures or 3D models), ensure the component is structured to be wrapped cleanly in a React
Suspenseboundary with a fallback loader. - Clean up any subscriptions, timers, or imperative animations on unmount.
-
Deliverables:
- Provide the complete TypeScript component code.
- Provide a usage example showing how to import, configure, and render the component inside a parent R3F
<Canvas>.
A. Field Research Lab (PokeCenter / Lab) Rough Dimensions: w: 6.0 units, h: 4.5 units, d: 5.0 units (6x5 tile footprint) Aesthetic: Low-poly futuristic research facility with a bright crimson roof (#D32F2F), off-white insulated wall panels (#E0E0E0), glass entrance doors, and an illuminated blue solar ridge trim. Prompt: Create a low-poly 3D React Three Fiber component FieldLab3D.tsx. Footprint is 6x5 units. Feature an off-white modular wall box, a hipped red metallic roof, blue glass double doors at (0, 0, 2.4), two glass windows on front sides, and an illuminated blue solar panel strip across the roof ridge. Use meshStandardMaterial with shadows enabled.
-
- Assistant
Implemented a production-ready procedural Field Lab R3F asset and interactive showcase.
- Reusable component:
src/components/FieldLab3D.tsx - Canvas usage example and interactive demo:
src/App.tsx - Responsive presentation and motion styling:
src/index.css - Added Three.js, React Three Fiber, Drei, and Framer Motion dependencies
- Includes typed group props, configurable colors, shadows, memoized geometry/materials, disposal cleanup, hover feedback, animated doors, and pulsing solar ridge
- Added orbit, night-lighting, reset, responsive camera, and copyable usage controls
- No external textures or model files required
Production build verified successfully with
npm run build. - Reusable component:
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.