sigmaxipi / chromium-for-stadia

Quick hack to get Google Stadia running on unsupported Android devices
155 stars 19 forks source link

Issue about gvr-android-sdk #12

Open PhanSon95 opened 4 years ago

PhanSon95 commented 4 years ago

@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:

sigmaxipi commented 4 years ago

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 commented 4 years ago

@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 commented 4 years ago

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

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

sigmaxipi commented 4 years ago

You can try using the code in https://github.com/googlevr/gvr-android-sdk/issues/574 and seeing if that helps.

PhanSon95 commented 4 years ago

@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.