October 2017
Intermediate to advanced
294 pages
6h 49m
English
Let's convert this into an actionable menu. We could map an action to each face of the cube. As we are rotating the cube horizontally, or on the y axis, we could map an action to each of the four available faces.
For added clarity, as currently the rotation might end in the middle of a face, let's add a small feature: whenever the animation finishes, let's snap it to the closest face, so we'll always have a fully aligned front face of the cube when there is no animation running.
Implementing snapping is fairly simple. We have got to check if the animation has finished and, in that case, check which face is facing to the camera. We could do so by simply dividing the current rotation angle by 90; 360 degrees split ...
Read now
Unlock full access