| | |
| | | import Box from './box'; |
| | | import * as Common from '../utils/common' |
| | | |
| | | 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); |
| | | }); |
| | | } |
| | | }; |
| | | let lastData = {}; |
| | | |
| | | const Agv = (props) => { |
| | | const { position, theta } = props; |
| | |
| | | useEffect(() => { |
| | | console.log(position); |
| | | console.log(theta); |
| | | |
| | | }, [props]); |
| | | |
| | | const bodyModel = useMemo(() => { |
| | | const fbx = useFBX('/models/agv/body.fbx'); |
| | | if (!fbx.castShadow) { |
| | | setShadow(fbx); |
| | | Common.setShadow(fbx); |
| | | } |
| | | return fbx.clone(); |
| | | }, []) |
| | |
| | | const loaderModel = useMemo(() => { |
| | | const fbx = useFBX('/models/agv/loader.fbx'); |
| | | if (!fbx.castShadow) { |
| | | setShadow(fbx); |
| | | Common.setShadow(fbx); |
| | | } |
| | | return fbx.clone(); |
| | | }, []) |
| | |
| | | const forkModel = useMemo(() => { |
| | | const fbx = useFBX('/models/agv/fork.fbx'); |
| | | if (!fbx.castShadow) { |
| | | setShadow(fbx); |
| | | Common.setShadow(fbx); |
| | | } |
| | | return fbx.clone(); |
| | | }, []) |