Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue about gvr-android-sdk #12

Open
PhanSon95 opened this issue Jan 14, 2020 · 5 comments
Open

Issue about gvr-android-sdk #12

PhanSon95 opened this issue Jan 14, 2020 · 5 comments

Comments

@PhanSon95
Copy link

PhanSon95 commented Jan 14, 2020

@sigmaxipi First, I'm so sorry when post issue incorrect repository.
Because repository gvr-android-sdk has been archived so I can't submit new issue or give you a question.
I have a problem when play video 360:

  • When I play video 360 on with your sample, on first open starting angle of video correct ( center on frame 360 video ) , but in 2nd, 3nd... when I open video, the angle of video is different at each time open.
    I don't know why. I hope you can help me
    Again, I'm so sorry because post issue at here
@sigmaxipi
Copy link
Owner

You can try adding logs to https://github.com/googlevr/gvr-android-sdk/blob/master/samples/sdk-video360/src/main/java/com/google/vr/sdk/samples/video360/MonoscopicView.java#L132 and see what the Android sensor is outputing each time

@PhanSon95
Copy link
Author

PhanSon95 commented Jan 16, 2020

@sigmaxipi thank you because response to my issue.

public void onSensorChanged(SensorEvent event) {
            SensorManager.getRotationMatrixFromVector(phoneInWorldSpaceMatrix, event.values);

            // Extract the phone's roll and pass it on to touchTracker & renderer. Remapping is required
            // since we need the calculated roll of the phone to be independent of the phone's pitch &
            // yaw. Any operation that decomposes rotation to Euler angles needs to be performed
            // carefully.
            SensorManager.remapCoordinateSystem(
                    phoneInWorldSpaceMatrix,
                    SensorManager.AXIS_X, SensorManager.AXIS_MINUS_Z,
                    remappedPhoneMatrix);
            SensorManager.getOrientation(remappedPhoneMatrix, anglesRadians);
            float roll = anglesRadians[2];
            touchTracker.setRoll((float) (roll - Math.toRadians(displayRotationDegrees)));

            Log.d("MonoscopicView", "roll :[" + roll + "]");
            // Rotate from Android coordinates to OpenGL coordinates. Android's coordinate system
            // assumes Y points North and Z points to the sky. OpenGL has Y pointing up and Z pointing
            // toward the user.
            Matrix.rotateM(phoneInWorldSpaceMatrix, 0, 90, 1, 0, 0);
            renderer.setDeviceOrientation(phoneInWorldSpaceMatrix, roll);
        }

I've added log about roll value which was saved here
Password: gvr

@PhanSon95
Copy link
Author

PhanSon95 commented Jan 16, 2020

@sigmaxipi I've realized this bug will appear when:

  • First: open video 360, hold device front and angle is 0 degree
  • Second: move device from 0 to the left 90 degree, then exit player
    **** Open video again on front, but now angle of video at point when rotate -> left 90

It's mean : video's angle when start will be last angle before you exit video

@sigmaxipi
Copy link
Owner

You can try using the code in googlevr/gvr-android-sdk#574 and seeing if that helps.

@PhanSon95
Copy link
Author

PhanSon95 commented Jan 17, 2020

@sigmaxipi Thank you for your response. I've applied your solution at here 1 month ago.
It's worked with case when I change device's orientation from portrait -> landscape
But my case is angle when start video. When I put my video 360 on your sample sdk-video360 and play, so error still appear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants