| | |
| | | height: 0, |
| | | loaderTheta: 0, |
| | | forkLength: 0, |
| | | trayList: [], |
| | | trayList: [ |
| | | { |
| | | no: 1, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 2, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 3, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 4, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 5, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 6, |
| | | hasBox: false |
| | | }, |
| | | ], |
| | | hasBox: false |
| | | } |
| | | ], |
| | |
| | | height: 0, |
| | | loaderTheta: 0, |
| | | forkLength: 0, |
| | | trayList: [], |
| | | trayList: [ |
| | | { |
| | | no: 1, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 2, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 3, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 4, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 5, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 6, |
| | | hasBox: false |
| | | }, |
| | | ], |
| | | hasBox: false |
| | | } |
| | | ], |
| | |
| | | height: 0, |
| | | loaderTheta: 0, |
| | | forkLength: 0, |
| | | trayList: [], |
| | | trayList: [ |
| | | { |
| | | no: 1, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 2, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 3, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 4, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 5, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 6, |
| | | hasBox: false |
| | | }, |
| | | ], |
| | | hasBox: false |
| | | } |
| | | ], |
| | |
| | | height: 100, |
| | | loaderTheta: 0, |
| | | forkLength: 0, |
| | | trayList: [], |
| | | trayList: [ |
| | | { |
| | | no: 1, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 2, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 3, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 4, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 5, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 6, |
| | | hasBox: false |
| | | }, |
| | | ], |
| | | hasBox: false |
| | | } |
| | | ], |
| | |
| | | height: 150, |
| | | loaderTheta: 0, |
| | | forkLength: 0, |
| | | trayList: [], |
| | | trayList: [ |
| | | { |
| | | no: 1, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 2, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 3, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 4, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 5, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 6, |
| | | hasBox: false |
| | | }, |
| | | ], |
| | | hasBox: false |
| | | } |
| | | ], |
| | |
| | | height: 200, |
| | | loaderTheta: 0, |
| | | forkLength: 0, |
| | | trayList: [], |
| | | trayList: [ |
| | | { |
| | | no: 1, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 2, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 3, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 4, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 5, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 6, |
| | | hasBox: false |
| | | }, |
| | | ], |
| | | hasBox: false |
| | | } |
| | | ], |
| | |
| | | height: 100, |
| | | loaderTheta: 0, |
| | | forkLength: 0, |
| | | trayList: [], |
| | | trayList: [ |
| | | { |
| | | no: 1, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 2, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 3, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 4, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 5, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 6, |
| | | hasBox: false |
| | | }, |
| | | ], |
| | | hasBox: false |
| | | } |
| | | ], |
| | |
| | | height: 100, |
| | | loaderTheta: 0, |
| | | forkLength: 40, |
| | | trayList: [], |
| | | trayList: [ |
| | | { |
| | | no: 1, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 2, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 3, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 4, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 5, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 6, |
| | | hasBox: false |
| | | }, |
| | | ], |
| | | hasBox: false |
| | | } |
| | | ], |
| | |
| | | height: 100, |
| | | loaderTheta: 0, |
| | | forkLength: 40, |
| | | trayList: [], |
| | | trayList: [ |
| | | { |
| | | no: 1, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 2, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 3, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 4, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 5, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 6, |
| | | hasBox: false |
| | | }, |
| | | ], |
| | | hasBox: true |
| | | } |
| | | ], |
| | |
| | | height: 100, |
| | | loaderTheta: 0, |
| | | forkLength: 0, |
| | | trayList: [], |
| | | trayList: [ |
| | | { |
| | | no: 1, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 2, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 3, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 4, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 5, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 6, |
| | | hasBox: false |
| | | }, |
| | | ], |
| | | hasBox: true |
| | | } |
| | | ], |
| | |
| | | height: 0, |
| | | loaderTheta: 0, |
| | | forkLength: 0, |
| | | trayList: [], |
| | | trayList: [ |
| | | { |
| | | no: 1, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 2, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 3, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 4, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 5, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 6, |
| | | hasBox: false |
| | | }, |
| | | ], |
| | | hasBox: true |
| | | } |
| | | ], |
| | |
| | | height: 0, |
| | | loaderTheta: 270, |
| | | forkLength: 0, |
| | | trayList: [], |
| | | trayList: [ |
| | | { |
| | | no: 1, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 2, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 3, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 4, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 5, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 6, |
| | | hasBox: false |
| | | }, |
| | | ], |
| | | hasBox: true |
| | | } |
| | | ], |
| | |
| | | height: 0, |
| | | loaderTheta: 270, |
| | | forkLength: 40, |
| | | trayList: [], |
| | | trayList: [ |
| | | { |
| | | no: 1, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 2, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 3, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 4, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 5, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 6, |
| | | hasBox: false |
| | | }, |
| | | ], |
| | | hasBox: true |
| | | } |
| | | ], |
| | |
| | | height: 0, |
| | | loaderTheta: 270, |
| | | forkLength: 40, |
| | | trayList: [], |
| | | trayList: [ |
| | | { |
| | | no: 1, |
| | | hasBox: true |
| | | }, |
| | | { |
| | | no: 2, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 3, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 4, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 5, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 6, |
| | | hasBox: false |
| | | }, |
| | | ], |
| | | hasBox: false |
| | | } |
| | | ], |
| | |
| | | height: 0, |
| | | loaderTheta: 270, |
| | | forkLength: 0, |
| | | trayList: [], |
| | | trayList: [ |
| | | { |
| | | no: 1, |
| | | hasBox: true |
| | | }, |
| | | { |
| | | no: 2, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 3, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 4, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 5, |
| | | hasBox: false |
| | | }, |
| | | { |
| | | no: 6, |
| | | hasBox: false |
| | | }, |
| | | ], |
| | | hasBox: false |
| | | } |
| | | ], |
| | |
| | | height: 0, |
| | | loaderTheta: 0, |
| | | forkLength: 0, |
| | | trayList: [], |
| | | trayList: [ |
| | | { |
| | | no: 1, |
| | | hasBox: true |
| | | }, |
| | | { |
| | | no: 2, |
| | | hasBox: true |
| | | }, |
| | | { |
| | | no: 3, |
| | | hasBox: true |
| | | }, |
| | | { |
| | | no: 4, |
| | | hasBox: true |
| | | }, |
| | | { |
| | | no: 5, |
| | | hasBox: true |
| | | }, |
| | | { |
| | | no: 6, |
| | | hasBox: true |
| | | }, |
| | | ], |
| | | hasBox: false |
| | | } |
| | | ], |
| | |
| | | if (!props || Object.keys(props).length === 0) { |
| | | return; |
| | | } |
| | | |
| | | // group position |
| | | const pos = { |
| | | x: position?.[0], |
| | |
| | | |
| | | // loader theta |
| | | if (integrateTheta !== loaderTheta) { |
| | | console.log(integrateTheta, loaderTheta); |
| | | const minTheta = Common.minDiffTheta(integrateTheta, loaderTheta); |
| | | console.log(minTheta); |
| | | new TWEEN.Tween({ value: integrateTheta }) |
| | | .to({ value: minTheta }, INTERVAL_TIME) |
| | | .easing(TWEEN.Easing.Linear.None) |
| | |
| | | {hasBox && <Box position={[0, 24, 0]} />} |
| | | </group> |
| | | </group> |
| | | <group> |
| | | {trayList?.[0]?.hasBox && <Box rotationY={Math.PI / 2} position={[-43, 25, 0]} />} |
| | | {trayList?.[1]?.hasBox && <Box rotationY={Math.PI / 2} position={[-43, 48, 0]} />} |
| | | {trayList?.[2]?.hasBox && <Box rotationY={Math.PI / 2} position={[-43, 71, 0]} />} |
| | | {trayList?.[3]?.hasBox && <Box rotationY={Math.PI / 2} position={[-43, 94, 0]} />} |
| | | {trayList?.[4]?.hasBox && <Box rotationY={Math.PI / 2} position={[-43, 117, 0]} />} |
| | | {trayList?.[5]?.hasBox && <Box rotationY={Math.PI / 2} position={[-43, 140, 0]} />} |
| | | </group> |
| | | </group> |
| | | </> |
| | | ) |
| | |
| | | import { useFrame } from '@react-three/fiber'; |
| | | import { useFBX, useAnimations } from '@react-three/drei'; |
| | | import * as THREE from 'three'; |
| | | |
| | | const setShadow = (obj) => { |
| | | obj.castShadow = true; |
| | | obj.receiveShadow = true; |
| | | |
| | | if (obj.children) { |
| | | obj.children.forEach((child) => { |
| | | setShadow(child); |
| | | }); |
| | | } |
| | | }; |
| | | |
| | | const setColor = (obj) => { |
| | | if (obj.material) { |
| | | obj.material.color.set(0x4680BF); |
| | | } |
| | | if (obj.children) { |
| | | obj.children.forEach((child) => { |
| | | setColor(child); |
| | | }); |
| | | } |
| | | }; |
| | | import { MODEL_BOX_SCALE } from '@/config/setting' |
| | | import * as Common from '../utils/common'; |
| | | |
| | | const Box = (props) => { |
| | | const { position = [0, 300, 0] } = props; |
| | | const { position = [0, 300, 0], rotationY = 0 } = props; |
| | | |
| | | const boxModel = useMemo(() => { |
| | | const fbx = useFBX('/models/box/box.fbx'); |
| | | if (!fbx.castShadow) { |
| | | setShadow(fbx); |
| | | Common.setShadow(fbx); |
| | | } |
| | | fbx.scale.set(MODEL_BOX_SCALE, MODEL_BOX_SCALE, MODEL_BOX_SCALE); |
| | | return fbx.clone(); |
| | | }, []) |
| | | |
| | |
| | | |
| | | return ( |
| | | <> |
| | | <group rotation={[0, 0, 0]} scale={0.5} position={position}> |
| | | <group rotation-y={rotationY} scale={0.5} position={position}> |
| | | <primitive object={boxModel} castShadow /> |
| | | </group> |
| | | </> |
| | |
| | | export const INTERVAL_TIME = 500; |
| | | |
| | | export const MODEL_AGV_SCALE = .5; |
| | | |
| | | export const MODEL_BOX_SCALE = 1; |