I am using setAzimuthalAngle and setPolarAngle to set the angle of the camera. I already have used this and I know how it should be written. But the problem I have now which I dont understand is undefined x.
Note: The problem doesnt occure in product.camera.x. If I hardcode these values it will display the same error.
const radiusAngle = (deg) => (Math.PI / 180) * deg;
useEffect(() => {
if (orbitRef.current) {
orbitRef.current.setAzimuthalAngle(radiusAngle(product.camera.x));
product.camera.y !== null &&
orbitRef.current.setPolarAngle(radiusAngle(product.camera.y));
}
}, [product.camera.x, product.camera.y]);