Unity Rotating a Cube
I am new to Unity.
I have a default cube in a scene that I am viewing from position (5, 5, 5). What I see is as I expect. That is, a hexagon divided into 3 diamonds with a Y shape.
I want to be able to bring each of the 6 vertex's (that are the corners of hexagon) into the central position using a rotation.
For example, a rotation of ~70.58 about axis (-1, 0, 1) (using world co-ordinates) has the desired and will move the cube corner (1,1,-1) to (1,1,1) the centre of the viewed cube.
The hexagon is now divided into 3 diamonds with an inverted Y shape.
The next rotation needs to be ~109.42 to do the same thing.
But I want to do this many repeated times across all axis without the accumulation of rounding errors and I can't get my head around how to do this.
So, I have considered changing to moving the camera (rather than the cube). Here it is simple that the camera is going to be positioned at one of the eight possible combination of (+ or - 5 for each of x, y and z).
This was promising but I am not sure how to deal with the camera flip that appeared when the camera went 'over the top' and the view oscillated (undesirable to me) on the other axis (I was just using transform.LookAt(cube)) to keep the cube in the view.
Any pointers as to how I can rotate my cube in the way I desire simply would be appreciated.
@JohnTay1or - I'm thinking I might get what you want, but I'd say it's better you post an image of what you want... if you expect plenty of answers.
Your answer
![](https://koobas.hobune.stream/wayback/20220612174029im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Limit Cam rotation 0 Answers
Movement in the direction the user is facing with arrow keys 0 Answers
How do i limit the rotation of a game object in relation to a free following camera ? 0 Answers
Como desplazar la camara en un juego en tercera persona 0 Answers
Switch between touchscreen and Google VR to control the Unity camera 1 Answer