Hello,
I have code like this -
<Canvas
gl={{
preserveDrawingBuffer: false,
antialias: true,
}}
>
<PresentationControls
polar={[-Math.PI / 2, Math.PI / 2]}
azimuth={[-Infinity, Infinity]}
>
<Stage
preset={"portrait"}
intensity={1}
shadows={false}
adjustCamera={1.2}
environment={"forest"}
>
<SomeModel />
</Stage>
</PresentationControls>
</Canvas>
I want to track the rotation of the model using a state, but the PresentationControls does not have any onChange like events that I can use. How can I get the rotation values when the model is rotated using the PresentationControl?
I considered using Orbit Controls like -
<OrbitControls
onEnd={(e) => {
setRotationX(eulerToDegree(e.target.object.rotation.x));
setRotationY(eulerToDegree(e.target.object.rotation.y));
setRotationZ(eulerToDegree(e.target.object.rotation.z));
}}
/>
But Orbit Controls rotate the camera rather than the object, which is not what I want.