0

I'm working on a 360 video player app for android. I have 3 playback modes: touch mode, gyro mode and cardboard mode. I'm able to see gyroscope mode and cardboard mode ok with the cardboard stereo renderer, but I couldn't find a way of stopping the orientation sensors for the touch mode.

Usually, I would work with SensorManagerand then use this function: sm.unregisterListener(this, sm.getDefaultSensor(Sensor.TYPE_ROTATION_VECTOR)); in the object or class that was acting as de SensorListener of the application. The problem is that this work now is done natively in the Google Cardboard code and I can't see where the Sensor changes are processed.

Thus, my question is: is there some way to stop orientation sensors besides the method descrived above? Or some other way to get this method to work?

I've tried using it with the view, the renderer and the activity but couldn't get it to work. Also I searched in google cardboard api but find nothing useful. If this is impossible to be done, is it viable to work with two separate renderers and associated views for the different playback modes? If so, I would appreciate any guide on how to get them to work.

If you need any more info, ask me and I'll be glad to explain anything else.

SMalpica
  • 128
  • 10

1 Answers1

1

I have figure out a trick to do that by applying ViewMatrix to eyeMatrix in the function onDrawEye() in RajawaliCardboardRenderer class.

@Override
public void onDrawEye(Eye eye) {
    eyeMatrix.setAll(getCurrentCamera().getViewMatrix());
    eyeQuaternion.fromMatrix(eyeMatrix);
    getCurrentCamera().setOrientation(eyeQuaternion);
}
Damian Kozlak
  • 7,065
  • 10
  • 45
  • 51
Sowattana Sigen
  • 202
  • 2
  • 10
  • You're welcome. Anyway, I see you can work with touch mode already. Can you please kindly share your answer to my question below? http://stackoverflow.com/questions/32827438/move-camera-around-using-touch-event-in-cardboard-and-rajawali-vr-android – Sowattana Sigen Sep 28 '15 at 16:16
  • Sure! I'll post it later, if you don't mind. Just to be sure, you want to know how to handle touch events to rotate a 3D object, right? – SMalpica Sep 29 '15 at 09:21
  • Actually, I am using Rajawali to play the video in CardBoardView, and I want to use touch event to move the camera instead of moving head (sensor). I am not sure it is a 3D object or not. – Sowattana Sigen Sep 30 '15 at 01:17
  • I'll show you the method I'm using, but I'm rotating the sphere where the video is playing instead of the camera. – SMalpica Sep 30 '15 at 08:51
  • i have tried this answer but its not working any one can help me out in this – Nikhil Sharma Jul 01 '17 at 11:15