Replies: 2 comments 1 reply
-
you mean something like this? https://codesandbox.io/s/react-three-fiber-viewcube-py4db |
Beta Was this translation helpful? Give feedback.
1 reply
-
btw check out https://github.com/react-spring/drei it makes setting up custom cameras easier |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I had two files.
Set main camera
const { camera } = useThree();
useEffect(() => {
camera.position.set(0, -3, 40); // default 0, 0, 50
camera.lookAt(0, -3, -0);
camera.updateProjectionMatrix();
}, []);
Create second camera
const { viewport } = useThree();
const sceneCamera = useMemo(() => {
const cam = new THREE.OrthographicCamera(
(viewport.width / -2) * addRatio,
(viewport.width / 2) * addRatio,
viewport.height / 2,
viewport.height / -2,
0.1,
1000
);
cam.position.z = 40;
cam.updateProjectionMatrix();
return cam;
}, [viewport]);
return (
<Component={sceneCamera}>
)
I'm set position of main camera.
But second camera was not refresh viewport.
How refresh second camera when after main camera setting.
Beta Was this translation helpful? Give feedback.
All reactions