| | |
| | | // 添加场景相机 |
| | | import { useThree, PerspectiveCameraProps } from '@react-three/fiber'; |
| | | import React, { useState, useEffect } from 'react'; |
| | | import { useThree } from '@react-three/fiber'; |
| | | import { |
| | | PerspectiveCamera, |
| | | CameraControls, |
| | |
| | | FirstPersonControls, |
| | | MapControls, |
| | | } from '@react-three/drei'; |
| | | import React, { useState, useEffect } from 'react'; |
| | | |
| | | const Camera = (props) => { |
| | | const threeObj = useThree(); |
| | | const camera = threeObj.camera; |
| | | |
| | | const [choiceCtrls, setChoiceCtrls] = useState(true); |
| | | const mobxStore = useContext(ThreeStoreContext); |
| | | |
| | | const flyCtrl = () => { |
| | | return ( |
| | |
| | | <div style={{ height: '100%', width: '100%' }}> |
| | | <Canvas> |
| | | <Lights /> |
| | | {/* <Camera /> */} |
| | | <Camera /> |
| | | <Sky distance={450000} sunPosition={[0, 1, 0]} inclination={0} azimuth={0.25} /> |
| | | <Box position={[0, 0, 0]} /> |
| | | <OrbitControls /> |
| | |
| | | onClick={(event) => click(!clicked)} |
| | | onPointerOver={(event) => (event.stopPropagation(), hover(true))} |
| | | onPointerOut={(event) => hover(false)}> |
| | | <boxGeometry args={[1, 1, 1]} /> |
| | | <boxGeometry args={[10, 10, 10]} /> |
| | | <meshStandardMaterial color={hovered ? 'hotpink' : 'orange'} /> |
| | | </mesh> |
| | | ) |