Who would modify a gyroscope script?

I’ve been testing a gyroscope script,the cube can be observed through the gyroscope of the mobile phone
However, there is a problem in this project, that is, the gyroscope data obtained in portrait is correct, while the gyroscope obtained in landscape state is wrong, and the picture is slanted
the project:PlayCanvas 3D HTML5 Game Engine

Hi @leooooooo,

I think you will have to check in your code if the phone is in portrait or in landscape mode and adapt your code accordingly (e.g. swap angles).

One easy way to get the orientation:

const isPortrait = window.innerHeight >= window.innerWidth;
1 Like

Do you have any case I can refer to? I’m not very familiar with the use of this gyroscope.

At present, the gyroscope can be called laterally, but the camera is offset by 90 degrees