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 { GrabbableObject } from "@/components/3d/GrabbableObject"; import { TriggerObject } from "@/components/3d/TriggerObject"; import { TEST_SCENE_FLOOR_COLLIDER_HALF_EXTENTS, TEST_SCENE_FLOOR_POSITION, TEST_SCENE_FLOOR_SIZE, TEST_SCENE_GRABBABLE_BOX_SIZE, TEST_SCENE_GRABBABLE_COLOR, TEST_SCENE_GRABBABLE_METALNESS, TEST_SCENE_GRABBABLE_POSITION, TEST_SCENE_GRABBABLE_ROUGHNESS, TEST_SCENE_TRIGGER_COLOR, TEST_SCENE_TRIGGER_METALNESS, TEST_SCENE_TRIGGER_POSITION, TEST_SCENE_TRIGGER_RADIUS, TEST_SCENE_TRIGGER_ROUGHNESS, TEST_SCENE_TRIGGER_SEGMENTS, TEST_SCENE_TRIGGER_SOUND_PATH, } from "@/data/testSceneConfig"; 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 ( <> ); }