- Home /
Unfold a cube into 6 squares with an animation.
Essentially what I want to do is take a regular cube game object and unfold it (With animation of it unfolding ideally) into a cube map/6 squares joined together like a cube. I've been unable to find any information on how to do this but I do know it's possible or should be possible.
I'd then add text to the unfolded squares and when the user is done they'd fold back up into a cube. (basically the cubes represent information and the user can click one to view more information and that's how the new information will be displayed)
Using C# for this.
It would be better to do it using blender (it is free) it is animation software it would probably be better as you can have control over pivot points which help create animations that you want
you can do this in unity but it looks a bit janky unless you spend a bit of time lining up game objects to use as pivots
to do it in unity make an empty game object called parentPanal then inside it make two empty game objects one called Back and the other called front inside these game objects add a cube with the dimensions of 1 x 1 x 0.1
at the top of the unity editor clip window => Animation to open the animation editor
now click on parentPanal in the animation window click under in the middle to move the red line ( scrubber )
if unity askes you to save it is trying to make an animation clip name it myAnimation1 or something and allow it to save
if you rotate the front panal you should see some diamonds come up is for animation you made
Answer by Arycama · Sep 28, 2015 at 06:24 AM
If you're referring to the cube created by going to GameObject > 3D Object > Cube, it would be rather complicated as you would have to reposition all the vertices of each triangle with code. (Or expose all the vertex positions in the inspector and control their position through an animation, while updating all of their positions every frame).
An easier solution would be to make your own "Cube" out of quads (GameObject > 3D Object > Quad), and parent each quad to an empty game object positioned to where you want each cube face to pivot, parent all of those game objects to a "Cube" parent, and simply make an animation within Unity where each face rotates around it's pivot until it is fully unfolded.
Thank you, after much playing around I've managed to get this to work perfectly.
One other question though, how do I get the child objects (the quads) to use their parents position as the starting point? I'm moving the cube (parent object) around to place it the same way I did previously with unitys cubes, which works find except that the children for some reason are all +2 on the y axis to the parent. It's not a major problem right now since I can just put -2 on the position but would like to know how to fix this or understand why it's happening if possible.
@Anakso I am willing to purchase that code if you still have it.
Your answer
Follow this Question
Related Questions
how to subdivide and smooth a cube in unity 1 Answer
Multiple Cars not working 1 Answer
Distribute terrain in zones 3 Answers
Stop and object from moving faster after a specific speed is reached? 2 Answers
Cube roll over hills/objects 2 Answers