Last active
June 12, 2020 15:28
-
-
Save Franckapik/5a706cd082fb0c0741bc186b9ef4c26b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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