Alexver

Rotating sprite with gyroscope

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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.