Make the camera maintenance page movement not trash. Thanks.

This commit is contained in:
gtoriadotnet 2021-12-17 23:26:40 -05:00
parent 28e0cb9969
commit a4353fee78
1 changed files with 5 additions and 2 deletions

View File

@ -69,8 +69,11 @@ function Box({ random, ...props }){
function Camera({ ...props }){
const ref = useRef()
useFrame((state) => {
const t = state.clock.getElapsedTime() / 70
ref.current.rotation.set(t, 0, t)
const t = state.clock.getElapsedTime() / 30
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 (
<PerspectiveCamera ref={ref} {...props} />