- Home /
How could I create a book?
I have started creating a first-person game. I want to have a book that stays with the player, and he or she can open it whenever they feel like it. On the asset store and the internet all I can seem to find are just models of closed books. How could I go about creating a book with flipping pages?
My inspiration was the book from this video: http://www.youtube.com/watch?v=YxDFGjz9s8E (At about 53 seconds into the video.)
Help is greatly appreciated. Thanks!
This seems like a great way to emulate it, and I'm going to try it. Although, I'm not entirely sure what quads are and how they work. Sorry, I am new and only using Unity for fun. I would be grateful if you helped a little more! I've been told that this is the best way.
Game Object > Create Other > Quad. Quads are a two triangle planes that are vertical with a rotation of (0,0,0).
Answer by robertbu · Oct 14, 2013 at 08:45 AM
The book in the video is fairly primitive. You can easily emulate it with some quads:
Create a Quad
Create a second Quad and rotate it 180 degrees on the 'Y'
Create an empty game object and place it on the right or left edge of the quads half way down the page.
Make the two Quads children of the empty game object.
Now you have a page. Create multiple pages and make them children of an empty object. Now you have a book. A page is turned by rotating the empty 'page' game object on its 'y' axis. There is some code to be written, but an experienced programmer could emulate the riffling of pages and the turning of pages in a couple of hours of work.
If the target is mobile, you might consider using an atlas for the pages to reduce draw calls. But even without an atlas, if you were careful about disabling the renderer for pages not seen, the draw calls would be low.
Consider building the book at runtime out of multiple page prefabs. This would allow you to easily assign textures to each page so you would not have to build a material for each page.
If you give up the riffling of pages, you can play a shell game with textures and only use three pages. If you were using high-res images, this shell game would allow you to load and unload textures.
@robertbu How can I do this but in a 2D game environment? As quads or basically any object in this environment won't have depth.
Answer by whydoidoit · Oct 13, 2013 at 04:11 PM
At $150 dollars, it's quite over budget. I have looked it over though. Is there anything else I could do?
Well you could write code that did that! There might be a model of a book somewhere, but I've not come across one...
you could try to create an animation from a skinned cloth.
I have attempted to write code, and there are a lot of book models, but they don't have pages. They are either open or closed. I have never worked with cloth, I'm not sure how difficult it is.
$$anonymous$$ake an empty game object, now create a front cover object with two planes back to back. $$anonymous$$ove the pivot point to the joint of the book. Do the same for the back cover. This goes on the empty game object. You now have a book. For the page, create skinned cloth with same process of back to back. $$anonymous$$ake an animation for turning pages.
I have never done that but if it works, you can sell it for $149, so you are cheaper.
Answer by CmdrZin · Jan 05, 2021 at 04:25 AM
You can rotate a UI element (like Text) about the Y axis. Set the pivot to 0,0 to pivot on the left edge. Gives you a see through page because the UI has no depth.
Thanks! It did work! But, how could I then add different textures to both sides of that UI element? I used a panel, for example that would work as a page.
A UI element has no depth, therefore it has no "sides". You could write some code that would use two Panels, one for front and one for back. Disable the first when the rotation gets to 90 degrees and enable the second to go from 90 to 180. As with most CGI, it's all an illusion. :)
Thanks. A couple more considerations:
I followed your first advice. It made the illusion of the UI panel "rolling" the page to the next one. I also created an script to make sure it would not only rotate, but move to where I wanted to.
Then, your second advice is where takes place and I'm about to try it out. Is there anything else you can tell me? Any other advice?
Answer by BoxSummer · Jan 05, 2021 at 01:55 AM
How can I do what robertbu said, but in a 2D environment? With UI elements?
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
How could I write a script to flip pages of a book? 1 Answer
UnityEngine.Input.GetMouseButton(1)) issue 1 Answer
Making a 2D Game, Flipping Textures ERROR 1 Answer
I made a better shader how do i fix[add _Shadow Strength]help???>Sorry that im asking for to much 1 Answer