I have a cube and a camera with orbit controls.
I want that when the camera rotates above the cube that the cubes scale grows.
means when the camera is on the side view (doesn’t matter which side) the cubes scale is 1 and when I start to rotate the camera to see the top-view of the cube, the cube should grow slowly till cameras rotation reached 90°.
Here a screenshot for better understanding:
I try to understand what exactly happens when I rotate the camera (with the orbit controls)
controls.addEventListener("change",(x)=>{
console.log(camera.rotation._y*180/Math.PI)
})
I understand now which axis I need to have an eye on:
camera.rotation.set(-90 * Math.PI/180,0,anyNumber);
//_y = 0 => topview 90 => sideview!
//_x = 0 => sideview -90 => topview
So I know _y = 90 and _x = -90 to have a topview. But how do I map these two numbers 0 till 90 (0 till -90) to a range of lets say 1 - 5; Cubes scale should be 1 if sideview and scale should be 5 if topview.
And also does this approch make sense when I have like 1000 cubes which I need to iterate on camera_rotation change?
Any suggestion is welcome!