CesiumGS / cesium

An open-source JavaScript library for world-class 3D globes and maps :earth_americas:
https://cesium.com/cesiumjs/
Apache License 2.0
12.74k stars 3.45k forks source link

Device orientation not behaving as expected #4135

Open gk1089 opened 8 years ago

gk1089 commented 8 years ago

I have been trying to implement the Cardboard sample code and am not getting the results as expected. I modified the code so that the Balloon were not visible (file attached) Cardboard2.txt

Issues that I noticed are:

I understand that this is still a nascent area for Cesium and I am willing to learn and implement it properly. Please nudge me in the right direction.

kaktus40 commented 8 years ago

Hello, I didn't understand your problem but about the quaternion maybe this pull could help you (fourth bullet)? I create an example into this pull request. Nevertheless thanks for your hack to obtain the focus in a sandcastle example.

gk1089 commented 8 years ago

My problem is simply that the VR mode-code is not working as expected. The code you have posted is about getting Roll, Pitch, Direction information from quaternion information, which is related but not exactly what I am looking for.

What I need is to understand how I can relate quaternion information to device orientation information (Alpha, Beta, Gamma) of an Android device.

lasalvavida commented 8 years ago

@gk1089, maybe check out the wolfram mathworld article on Euler Angles.

You can use Matrix3.fromRotationX, fromRotationY, and fromRotationZ to generate the B, C, and D matrices from the article.

Quaternion.fromRotationMatrix can make a quaternion from your resulting rotation matrix.

kaktus40 commented 8 years ago

From my pull request, it seems, you should map:

see here

pjcozzi commented 8 years ago

@bagnell do you have any insights here?

gk1089 commented 8 years ago

Does the issue discussed in the following link have any relation to it? https://github.com/AnalyticalGraphicsInc/cesium/issues/3256

pjcozzi commented 7 years ago

Forum post: https://groups.google.com/forum/#!topic/cesium-dev/cr2P2wfOwl4