In the previous blogs, we saw how to set up hand tracking, we learned about grab interaction and poke interaction. In this blog, we’ll see how to interact with canvases using ray interaction. We’ll also see how to create an interactable curved canvas.
Before we start:
The first thing we need to do here is to add the ray interactor prefab to our hands.
With that we have added the Ray Interactors, next we’ll create a canvas with UI.
In this section, we’ll create a very basic canvas with different types of UI.
When you test the scene you will notice that you will be able to see the canvas but not interact with it. To make it interactable we’ll have to set up a few more things. So let’s see how that’s done.
To make the canvas interactable we’ll need to add a Ray Interactable component and a few other components.
With that we have created an interactable canvas, now we’ll see how to make a curved canvas.
Creating a curved canvas is almost similar to creating a rectangular canvas, it just requires a few extra components.
With that, we have learned to create an intractable curved canvas.
The best way to use the ray interaction would be to keep the ray interactors and menus disabled at the beginning. On a button press, the menu can open up and the ray interactors can be enabled. If you would like to have a more curved canvas along the same curvature, then just duplicate the child GameObject RayInteractableCanvas, make the necessary changes and place it next to the current one.
In the next blog post, we’ll see how we can detect hand poses and perform some actions of our choice when it gets detected.
If you've enjoyed the insights shared here, why not spread the word? Share the post with your friends and colleagues who might also find it valuable.
Your support means the world to us and helps us create more content you'll love.