Currently, I am working on VR application for android that using google CardBoard and Rajawali to play the 360 video. The sensor is working well, but I cannot use touch to drag the scene or camera around correctly. Is there any way to enable touch mode in this app?
Any help is greatly appreciated! Thank you.
I've worked on the same thing, and this is what I used:
First, take a look at Rajawali's ArcballCamera class. You can see there how touch events are handled to rotate the camera with touch events.
The problem is I didn't liked the default behaviour of the rotation when the user moved across the screen, so I did another implementation on my own, based on the previous one and rotating directly the sphere I was looking to instead of the camera, so here it goes (all of this is inside my Renderer class, btw):
First, the declarations:
In the renderer's constructor I start the inizalizations (timer and control are used for the video control view, so don't pay atention to these):
And last but not least, the event listening (both for scaling and rotating):
With all of this settled, you only have to set the orientation on each render, like this:
As I've said, this works for me, but I'm only rotating the sphere. It shouldn't be difficult to addapt it to your needs, besides you have the Arcball class that is a camera and might be better for what you want. Anyway, I hope this is useful for you.