diff --git a/src/components/crystal/HeroCrystal3D.tsx b/src/components/crystal/HeroCrystal3D.tsx index 3eeb7c0..9eacc0f 100644 --- a/src/components/crystal/HeroCrystal3D.tsx +++ b/src/components/crystal/HeroCrystal3D.tsx @@ -7,7 +7,7 @@ */ import { Canvas, useFrame } from '@react-three/fiber'; -import { Center, Edges } from '@react-three/drei'; +import { Edges } from '@react-three/drei'; import { Suspense, useRef, useState, useEffect } from 'react'; import * as THREE from 'three'; import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js'; @@ -231,19 +231,22 @@ export function HeroCrystal3D({ gl={{ antialias: true, alpha: true }} dpr={[1, 2]} style={{ background: 'transparent' }} + // R3F treats `camera` as construction-only and never orients it, so a + // custom position leaves the camera facing world -Z instead of the + // crystal. Aim it at the origin (where geometry.center() puts the + // crystal's centroid) so it renders centred in the canvas. + onCreated={({ camera }) => camera.lookAt(0, 0, 0)} > }> -
- {geometry ? ( - - ) : ( - - )} -
+ {geometry ? ( + + ) : ( + + )}