- Home /
How could I use quads to make a book?
I've been told that quads are a good way to create a 3D book. The game I am creating is first-person, and I would like the player to be able to open a book whenever they like. They could flip pages, and look through the information given. In the future I will worry about adding words to the pages, and some other things.
I was inspired by this gameplay, about 53 seconds into the video: http://www.youtube.com/watch?v=YxDFGjz9s8E
The only problem is I don't know what they are, and how to use them. To put it simply, how would I create the covers and pages? I would be grateful if someone could talk me through it! Thanks.
Answer by robertbu · Oct 14, 2013 at 05:02 PM
Creating a whole book is beyond the scope of a UA question. There are multiple technical question, and multiple possible implementations, and you've not really specified how the book behaves...how it is brought out, how the user interacts with the pages, etc. Unity Forums is a better place for open design question. Since I gave you the comment about Quads in your previous question, I'll outline how you can build a page with Quads. This is not the only solution, and depending on your platform and number of pages, it might not be the best solution.
Import two textures into Unity to represent the front and back of a page
Create a new scene
Create a material new material (call it Page0). For this test, use Unlit/Texture for the shader. Add one of the page textures to the material.
Duplicate the material, replace the texture with texture for the second page.
Create a Quad (Game Object>Create Other>Quad)
Set it position to the origin (0,0,0).
Change it's 'Y' scale to 1.4
Name the Quad 'Page0'.
Duplicate this Quad
Rename it 'Page1'
Set the 'Y' rotation of 'Page1' to 180
Drag and drop the 'Page0' material onto the 'Page0' quad. Do the same for 'Page1'.
Create an empty game object.
Place the empty game object on the left edge of the quads half way down. The position should be (-.5, 0, 0). Name the empty game object 'Page'.
Make the two quads children of the empty 'Page' game object by dragging and dropping them on the 'page' game object in the hierarchy.
Now you have a page. If you rotate the empty game object on it 'Y' in the inspector, you will see this page flip. Multiple pages make a book. You will want to Create a empty game object 'Book', and make each page a child of the book. To get the look in the video, you will need to bring the book closer to the camera and rotate it on the 'x' axis. This movement and rotation should be done at the 'Book' level not the 'Page' level.
Personally I'd create one page prefab and build the book in code, but you can build all the pages by hand. As noted in the previous question, there are some potential performance issues with as I've described here depending on number of pages and the target platform.
As for the code, there are multiple ways to do the design. If this is something you are struggling with, I suggest you ask on Unity Forms. If you are struggling with a specific question like, "How do I flip one page," then post that specific question on UA.
Answer by Owen-Reynolds · Oct 14, 2013 at 04:35 PM
You were told wrong. Imagine you asked some chemists how to get a chocolate bar. They might say to start with 90% glycerol. "Build it with quads" is the same sort of joke answer. It's a reference to directly building a Mesh with a Unity program, instead of making it the easy way.
The book in the video is just some planes put together. Look up how to make double-sided planes in UA. Can use the parent-child trick make the planes spin on the ends (normally they would spin in the center.) As you practice Unity, this stuff will get easier. Maybe do non-book stuff for a while.
But, the book is just cutesy. If you want to present actual stuff for them to read, it has to be easy to read. Getting crisp text is hard enough already. Putting it at an angle, with perspective scrunching is going to strain eyes, and get old real fast. Better to just flash a book, make the page sounds, but have the text be standard GUI stuff (or a page-y background?)
@Owen Reynolds - actually I made the comment, and I was referring to Game Object > Create Other > Quad. I recommended the Quad since it only has two triangles and starts in the vertical orientation as opposed to the built-in plane.
Roberto: Nice to hear they added 4-vert planes in 4.1 (it's never a good time for me to update, still on 4.0.)
OP: sure, building pages out of GameObject->CreateOther->Quad seems fine. Can make a very thin cube for the covers (for thickness.)
But, from this Q and your answer below, it seems we agree the OP is completely new to all this. Is a book really a good first project? Put another way, if you were writing an intro to objects, positioning and simple scripts, would you have it be making a book?
No, a book would not be a first project. Though I taught a beginning programmer last year, and early in the year she did an iPad birthday card for her mom, and it used planes as pages just like I describe below. It had an animation on the front cover and particle effects and music. It was a good quick project to introduce many Unity concepts.
But the issue with the book will be designing the code to handle the various aspects...going to a specific page, paging forward and backward, riffling through pages, showing the book and putting it away. Design the code and the game objects right, and it is a quick project. Design it wrong and it will be a real struggle.
This is a continuation of the OPs previous question : http://answers.unity3d.com/questions/554933/how-could-i-create-a-book.html