viromedia / virocore

ViroCore cross-platform AR/VR renderer
MIT License
370 stars 108 forks source link

Rotation of Y axis is not calculated properly #271

Open mitchell-ganton opened 5 years ago

mitchell-ganton commented 5 years ago

Environment

OS: Mac Version: Latest ViroCore version Device(s): Android

Description

The rotation for x and z coordinates are calculated properly. However the y coordinate in not.

Reproducible Demo

Here we see how the z coordinate is calculated properly. When tilted 180 degrees on the z axis the value is pi

x_axis

When the y axis is tilted 180 degrees the value is zero.

y_axis

achuvm commented 5 years ago

Hi @mitchell-ganton,

This is simply because of how rotations work, a 180 degree rotation in the Y is the same as a 180 degree rotation in the X and the Z which is what you see at the end of your video (both the X and Z rotation values are equal to about PI).

Thanks,

ansonyao commented 5 years ago

Hi @achuvm , I am coworker of Mitch. we are a bit confused with this Y axis rotation thing. Our understanding is that if we rotate the phone around Y axis in 360 degree. The value in Y should change from 0 to pi to -pi and then back to 0 again, but this is apparently not happening. The confusing part is that this does happen for X and Z axis but just not for Y. Is there anything which makes Y axis different than others? If rotation along Y axis is somehow reflected via the value changes on X and Z. Is there any method in the framework such that we can calculated the angle when we rotate the phone around the Y axis?