- Home /
Interractive Content on Page Mesh (Mega-fiers)
I am creating an iPad interactive book using mega-fiers and was wondering how to make content on the page mesh touchable. I have seen an app on the store the does just that. I have several page meshes (from mega-fiers) that are my book's pages and each one needs to be able to have an object stretched across the face of the mesh and able to be manipulated. The mesh can turn like a page so I need the objects to follow the contour of the page. I am new to Unity so the most low level description possible would be appreciated.
If you make your content a picture and apply that as the texture of a material applied to the page mesh renderer then it will follow the shape of the mesh as $$anonymous$$egafiers changes it.
Create a picture of your content
Create a new material in the project
Choose a shader - maybe mobile diffuse?
Drop the picture on the texture of the material/shader
Apply the material to your page mesh
Now actually that may give you a problem with the page being visible on both sides - in which case you may need a dummy white page or something following on behind it that also follows the same modified shape but is just "behind" it - therefore obscuring the back of the first page.
Thank you for your help. I need to know how to attach multiple animated objects of some sort to the page itself. The book is going to be interactive so each object stuck to the page needs to be able to move. Any ideas specifically for this?
$$anonymous$$ake the frames of your animation pictures and then change the texture in the material I suggested above on a regular basis.
I guess it would help no know in what way these things are best animated from your perspective. Can you share some context about what they are?
Sure, in this interactive book I want to animate the different characters and objects, (e.g. houses, kites, flowers) in such a way that a child can touch something and effect it. So a kid could touch a kite and it would fly or touch a person and they would wave. That sort of thing. So I think that all of these need to be their own objects but they also need to stick to and bend with the page.
Hey that sounds like a cool project - ok I'll ponder it :) Or someone with a better idea might step in and give you an answer!
Answer by whydoidoit · Jun 01, 2012 at 08:37 PM
So I use Megafiers a bit - certainly not enough to do more than suggest this following - someone might have a much better idea that me :) I am presuming you are using the Megafiers Book script to build a book with multiple pages? I would suggest that what you do is have the items that will "float" etc as areas on the page that you map with a collider that is a child of the page mesh. Now the first problem there is that Megafier's books only have three pages - it works by mapping in as textures onto those pages as I was suggesting in my comments above.
So your choice is to do some automatic collider generation when a page is completely turned, or actually have only a certain number of areas that can contain an interactive shape. Which you choose I guess depends on your level of coding experience and the importance of this feature in your project.
I'm sure it would be possible to have the objects deform along with the page - but I don't have the experience of doing that and it is probably fiddly.
Let's say you decide to have "active" areas of every page
You need a data structure to represent the pages of your book
This data structure would contain a list of list of information about the interactive areas of the page
It would also contain the texture of the page
It would contain prefabs to instantiate when the page item was activated
Each of your page meshes would need to contain the same collider areas and each would have a script attached to detect the hit. Note I don't think these colliders will be in the right place until the page is lying flat. The easiest was would be to make a page mesh, add the colliders and then duplicate it to make the other two pages.
Your page mesh script would look for a touch on a collider in update using Physics.Raycast using the current touch position or mouse input:
When a touch was detected you would instantiate the prefab associated with that interactive area (note, you could just have some or all of them non-interactive on certain pages).
You would instantiate a plane with the background texture of the book page and the dimensions of the interactive area and place it over the content that initiated the interaction. > The kite appears to be a 3d object that starts from a picture of the kite on the page, which becomes invisible as the interactive object is created.
At some point the interative object would complete its job and vanish at which point you would fade away the alpha of the plane obscuring the picture of it to make it appear back in the book context.
You would have to disable book page turns during this interactive element to avoid strange overlaps and intersections.
You would use your page data structures to fill out the actual pages of the mega fiers book script (also setting the right number of pages of course). You would detect which page(s) was currently shown and use that to work out what to do on the collider touch.
Thank you very much for your help. I will try to implement some of this over the next several days. I think that the hardest part is still the content bending so I will still be looking for an answer to that part.
Your answer
Follow this Question
Related Questions
Generating mesh - performance issues? 5 Answers
high quality setting in maya -> unity 3D 2 Answers
Makes Mesh Follows the Edge Collider 0 Answers
Scene view looks better then the game itself... 0 Answers
Reusing Mesh 1 Answer