working bike

This commit is contained in:
math-pixel
2026-05-17 08:15:16 +02:00
parent cff7744ad9
commit fbedb90bca
5 changed files with 77 additions and 15 deletions
+7 -1
View File
@@ -1,12 +1,18 @@
import { useEffect } from "react";
import { useThree } from "@react-three/fiber";
import { PointerLockControls } from "@react-three/drei";
import { setGlobalCamera } from "@/world/GameCinematics";
export function PlayerCamera(): React.JSX.Element {
const camera = useThree((state) => state.camera);
useEffect(() => {
setGlobalCamera(camera);
return () => {
setGlobalCamera(null);
document.exitPointerLock();
};
}, []);
}, [camera]);
return <PointerLockControls />;
}