Open ganico opened 5 years ago
Given the viewMatrix
at https://github.com/googlevr/gvr-android-sdk/blob/master/samples/sdk-video360/src/main/java/com/google/vr/sdk/samples/video360/MonoscopicView.java#L315 you can multiple that with a vector <0,0,-1> and then compute the atan(x,z) of the resulting vector to get the yaw angle.
@sigmaxipi sorry, i don't quite understand most the things that you mentioned.. could you give a sample code to illustrate your response... thank you so much and sorry.
See https://threejs.org/docs/#api/en/math/Euler.setFromRotationMatrix which converts from a rotation matrix to Euler angles. The source code is at https://github.com/mrdoob/three.js/blob/34dc2478c684066257e4e39351731a93c6107ef5/src/math/Euler.js#L133
so basically this is the code that you're talking about "Math.atan2(x,z)" right? so i'm not totally sure how would I get the x & z from this line of code "Matrix.multiplyMM(viewProjectionMatrix, 0, projectionMatrix, 0, viewMatrix, 0);" would you help me understand this part?
You'll want to implement your own version of Euler.setFromRotationMatrix using the three.js source code as a starting point. Then you can pass in the viewMatrix
into that function to extract the yaw angle.
@sigmaxipi ohh.. that's what you mean? hmmm.. analyzing the library seems it has a way to get the angle, just need some tweaks. Anyway thanks for your responses, i'll try to investigate more on the code, maybe I can find something to use then convert into the current angle. Thanks for your response.
i'm currently using video360 sample project as a reference, I just want to get the current angle of the view is it possible? if yes, how?