Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Franckapik/5a706cd082fb0c0741bc186b9ef4c26b to your computer and use it in GitHub Desktop.
Save Franckapik/5a706cd082fb0c0741bc186b9ef4c26b to your computer and use it in GitHub Desktop.
import { useFrame, useThree } from "react-three-fiber";
import store from "../store/store";
export default function Camera() {
const { camera } = useThree();
useFrame(() => {
camera.position !== store.getState().camera.position
? store.dispatch({ type: "CAMERA POSITION", position: camera.position })
: null;
});
return null;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment