I am currently working on a Three.js project involving a dodecahedron. My goal is to have the camera zoomed in on one side of the dodecahedron and upon pressing a button, I want it to zoom out, rotate to face another side, and then zoom back in.
To clarify:
Imagine the camera is focused on side 1 and when I press "5", I expect the camera to zoom out, rotate towards side 5, and then zoom back in. It's crucial that the camera remains parallel to the base of the pentagon it's facing, maintaining the correct perspective throughout the movement. https://i.sstatic.net/qt4sd.jpg
Initially, I decided to start with a cube instead of diving into something more complex. I experimented with tweens (triggered by pressing 'G') to demonstrate basic movements, but the results weren't satisfactory in the fiddle link provided. jsfiddle
In an attempt to streamline the process, I began documenting the positions and rotations of each side view of the cube to identify any patterns. Although I noticed some recurring values, I struggled to translate them into a functional algorithm, especially for a dodecahedron. The recorded values are as follows:
side1 (0, 0, 600) (0, 0, 0)
side2 (600, 0, 0) (0, pi/2, 0)
side3 (0, 0, -600) (0, pi, 0);
side4 (-600, 0, 0) (0, -pi/2, 0);
side5 (0, 600, 0) (-pi/2, 0, 0);
side6 (0, -600, 0) (pi/2, 0, 0);
Although I can discern some patterns and relationships among these values, I'm unsure how to incorporate them into a cohesive function. This step is essential before attempting the same approach with a more intricate shape like a dodecahedron. Any advice or guidance on where to focus my efforts next would be highly appreciated. While using multiple if clauses might seem feasible, I believe there's a better solution waiting to be discovered.