Greetings!
I need to reverse the autorotation speed when the azimuth angle reaches -1 or 1
I am new to this field, so I will be grateful for a detailed answer.
Thanks!
const [speed, setSpeed] = useState(1); // 0.75
const ref = useRef(null);
useEffect(() => {
if (ref.current !== null) {
if (
ref.current.getAzimuthalAngle() === -0.9 ||
ref.current.getAzimuthalAngle() === 0.9
)
setSpeed(-speed);
}
}, [What should I pass here?]);
<OrbitControls autoRotate ref={ref}/>