Jump to content

Rotating sprite with gyroscope


Alexver
 Share

Recommended Posts

Hi guys,

I'm making a game which uses browser gyroscope data as player's input.

The aim of the game is to align a bar controlled by the player with a bar that continuously rotates. In order to rotate player's bar, the phone must be tilted on its x axis.

When holding the phone perfectly vertical (first image) there is no problem. But when the phone has some rotation on its y axis or is pointing downwards (second image), the rotation that I'm interested in is no longer correct.

x rotation

Is there any workaround to make x rotation relative to the position that the back of the phone is pointing to?

It is ok to use any library. I've tried gyronorm.js and gyro.js so far, but none of them are giving me the desired results.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...