| | |
| | | import * as THREE from 'three'; |
| | | import { MODEL_BOX_SCALE } from '@/config/setting' |
| | | import * as Common from '../utils/common'; |
| | | import { useStore } from '@/store'; |
| | | |
| | | const Box = (props) => { |
| | | const { position = [0, 300, 0], rotationY = 0 } = props; |
| | | const state = useStore(); |
| | | |
| | | const boxModel = useMemo(() => { |
| | | const fbx = useFBX('/models/box/box.fbx'); |
| | |
| | | }, []) |
| | | |
| | | useEffect(() => { |
| | | |
| | | }, []); |
| | | console.log(state.shelfList['1-1-1']); |
| | | }, [props]); |
| | | |
| | | return ( |
| | | <> |
| | |
| | | import { useGLTF, useFBX } from '@react-three/drei'; |
| | | import * as THREE from 'three'; |
| | | import { MODEL_SHELF_SCALE } from '@/config/setting' |
| | | import { snapshot } from 'valtio'; |
| | | import { useStore } from '@/store'; |
| | | import { DRACOLoader } from 'three/examples/jsm/loaders/DRACOLoader'; |
| | | import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader'; |
| | |
| | | }, []) |
| | | |
| | | useEffect(() => { |
| | | snapshot(state).models[no] = position; |
| | | state.shelfList[no] = position; |
| | | }, [props]); |
| | | |
| | | return ( |
| | |
| | | const store = proxy( |
| | | { |
| | | text: 'Hello World', |
| | | shelf: {}, |
| | | shelfList: {}, |
| | | } |
| | | ); |
| | | |