| | |
| | | export default [ |
| | | [ |
| | | { |
| | | no: 1, |
| | | position: [0, 0, 0], |
| | | theta: 0, |
| | | height: 100, |
| | | loaderTheta: 180, |
| | | forkLength: 0, |
| | | trayList: [], |
| | | hasBox: false |
| | | } |
| | | ], |
| | | [ |
| | | { |
| | | no: 1, |
| | | position: [100, 0, 0], |
| | | theta: 0, |
| | | height: 100, |
| | | loaderTheta: 180, |
| | | forkLength: 0, |
| | | trayList: [], |
| | | hasBox: false |
| | | } |
| | | ], |
| | | [ |
| | | { |
| | | no: 1, |
| | | position: [100, 0, 0], |
| | | theta: 90, |
| | | height: 100, |
| | | loaderTheta: 180, |
| | | forkLength: 0, |
| | | trayList: [], |
| | | hasBox: false |
| | | } |
| | | ], |
| | | [ |
| | | { |
| | | no: 1, |
| | | position: [100, 0, 200], |
| | | theta: 90, |
| | | height: 100, |
| | | loaderTheta: 180, |
| | | forkLength: 0, |
| | | trayList: [], |
| | | hasBox: false |
| | | } |
| | | ], |
| | | [ |
| | | { |
| | | no: 1, |
| | | position: [100, 0, 300], |
| | | theta: 90, |
| | | height: 100, |
| | | loaderTheta: 180, |
| | | forkLength: 0, |
| | | trayList: [], |
| | | hasBox: false |
| | | } |
| | | ], |
| | | [ |
| | | { |
| | | no: 1, |
| | | position: [100, 0, 300], |
| | | theta: 90, |
| | | height: 100, |
| | | loaderTheta: 180, |
| | | forkLength: 0, |
| | | trayList: [], |
| | | hasBox: false |
| | | } |
| | | ], |
| | | ] |
| | |
| | | import { useFBX, useAnimations } from '@react-three/drei'; |
| | | import * as THREE from 'three'; |
| | | import Box from './box'; |
| | | import * as Common from '../utils/common' |
| | | |
| | | const setShadow = (obj) => { |
| | | obj.castShadow = true; |
| | |
| | | }; |
| | | |
| | | const Agv = (props) => { |
| | | const { } = props; |
| | | const { position, theta } = props; |
| | | |
| | | useEffect(() => { |
| | | console.log(position); |
| | | console.log(theta); |
| | | }, [props]); |
| | | |
| | | const bodyModel = useMemo(() => { |
| | | const fbx = useFBX('/models/agv/body.fbx'); |
| | |
| | | }, []) |
| | | |
| | | useEffect(() => { |
| | | |
| | | }, []); |
| | | |
| | | return ( |
| | | <> |
| | | <group rotation={[0, 0, 0]} scale={0.5} position={[0, 0, 0]}> |
| | | <group rotation-y={Common.rotationParseNum(theta)} scale={0.5} position={position}> |
| | | <primitive object={bodyModel} castShadow /> |
| | | <primitive object={loaderModel} castShadow position={[0, 100, 0]} /> |
| | | <primitive object={forkModel} castShadow position={[0, 120, 0]} /> |
| | |
| | | import Box from '../components/box'; |
| | | import tunnelData from '../assets/data/tunnel'; |
| | | import Tunnel from '../components/tunnel'; |
| | | import agvRealDataList from '@/assets/data/agv' |
| | | |
| | | let index = 0; |
| | | |
| | | const Warehouse = (props) => { |
| | | |
| | |
| | | |
| | | useEffect(() => { |
| | | |
| | | setInterval(() => { |
| | | const agvRealData = agvRealDataList[index]; |
| | | if (agvRealData) { |
| | | setAgvData(agvRealData); |
| | | } |
| | | index++; |
| | | }, 2000) |
| | | }, []) |
| | | |
| | | const tunnelEl = useMemo(() => { |
| | |
| | | const boxEl = boxData.map((data, idx) => <Box key={idx} {...data} />) |
| | | |
| | | useFrame((state, delta) => { |
| | | // setAgvData(); |
| | | // setBoxData(); |
| | | |
| | | }) |
| | | |
| | | return ( |
New file |
| | |
| | | import * as THREE from 'three'; |
| | | |
| | | export const isNullOfUndefined = (param) => { |
| | | if (null === param || undefined === param) { |
| | | return true; |
| | | } else { |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | export const rotationToNum = (rotation) => { |
| | | let res = rotation * 180 / Math.PI; |
| | | if (res < 0) { |
| | | res += 360; |
| | | } else if (res > 360) { |
| | | res -= 360; |
| | | } |
| | | return res; |
| | | } |
| | | |
| | | export const rotationParseNum = (num) => { |
| | | return num * Math.PI / 180; |
| | | } |