I want to make a scene where you touch and drag to either direction and either way you go is another page. like turning a page in a book put its a loop. how would I do that ?
I know how to implement the touch part im just kinda confused about how to implement a rotating menu.
this is for android platform
I drew an example of what i meant and attached it.
Having implemented this type of interaction in the past, I have to say getting the basics working is fairly easy…but the finishing touches can really make it complicated. For example:
- Does the page switching maintain velocity?
- Does it snap back to the current page unless you reach a certain velocity or drag distance
- Does it loop?
- What happens when you swipe while it’s transitioning already?
- Etc etc etc.
I’m not going to address those tedious issues.
At a basic level (if you’re using built-in Unity GUI) you’re going to have to either mess with (potentially) a bunch of rects by changing the horizontal position. But a more direct method I prefer is using Matrix transformations instead (Matrix4x4).
I do not use the built-in Unity GUI because of performance and convenience issues. I use a custom in-house solution that essentially use a bunch of 3D planes. If you’re using something like this it’s a bit easier because you can move the camera or have all of your UI as a child of a game object container, then move that. There’s a solution in the Unity Asset store called UGH - Unity GUI Helper that contains a convenience class that can be used for exactly what you’re looking to do. I imagine that other UI solutions in the asset store also have this sort of functionality.