Make the camera maintenance page movement not trash. Thanks.
This commit is contained in:
parent
28e0cb9969
commit
a4353fee78
|
|
@ -69,8 +69,11 @@ function Box({ random, ...props }){
|
||||||
function Camera({ ...props }){
|
function Camera({ ...props }){
|
||||||
const ref = useRef()
|
const ref = useRef()
|
||||||
useFrame((state) => {
|
useFrame((state) => {
|
||||||
const t = state.clock.getElapsedTime() / 70
|
const t = state.clock.getElapsedTime() / 30
|
||||||
ref.current.rotation.set(t, 0, t)
|
ref.current.position.x = 10 * Math.cos(t);
|
||||||
|
ref.current.position.y = 4 * Math.sin(t);
|
||||||
|
ref.current.position.z = 10 * Math.sin(t);
|
||||||
|
ref.current.lookAt(0, 0, 0);
|
||||||
});
|
});
|
||||||
return (
|
return (
|
||||||
<PerspectiveCamera ref={ref} {...props} />
|
<PerspectiveCamera ref={ref} {...props} />
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue