import { useEffect, useRef } from "react"; import { Physics, RigidBody, CuboidCollider } from "@react-three/rapier"; import * as THREE from "three"; import { Octree } from "three/addons/math/Octree.js"; import { GrabCube } from "@/world/objects/GrabCube"; import { TriggerSphere } from "@/world/objects/TriggerSphere"; interface TestSceneProps { onOctreeReady: (octree: Octree) => void; } export function TestScene({ onOctreeReady, }: TestSceneProps): React.JSX.Element { const floorRef = useRef(null); const octreeBuilt = useRef(false); useEffect(() => { if (octreeBuilt.current || !floorRef.current) return; octreeBuilt.current = true; floorRef.current.updateMatrixWorld(true); const octree = new Octree(); octree.fromGraphNode(floorRef.current); onOctreeReady(octree); }, [onOctreeReady]); return ( <> {/* Invisible floor mesh for Octree player collision */} {/* Rapier physics for interactable objects */} ); }