I am trying to create a 360 image viewer with @react-three, but I cannot place the camera inside, although I have centered both of them at 0, 0, 0.
Here it is a codesandbox link with my project
I am pretty new to three.js by the way, so I was just following this tutorial on how to create it with vanilla javascript, but I need it to be done in React
const Sphere = ({ size }) => {
const texture = useLoader(TextureLoader, Load360);
return (
<mesh position={[0, 0, 0]} scale={[size, size, size]}>
<sphereGeometry args={[1, 64, 64]} />
<meshStandardMaterial map={texture} />
</mesh>
);
};
const CameraControls = () => {
const { camera, gl } = useThree();
return <OrbitControls position={[0, 0, 0]} args={[camera, gl.domElement]} />;
};
export default function App() {
return (
<div style={{ height: "100vh", width: "100vw" }}>
<Canvas>
<ambientLight intensity={0.5} />
<Sphere size={3} />
<CameraControls />
</Canvas>
</div>
);
}