Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3876836
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T22:25:41+00:00 2026-05-19T22:25:41+00:00

I have previously created a labyrinth game which works with Firefox’s MozOrientation. I am

  • 0

I have previously created a labyrinth game which works with Firefox’s MozOrientation. I am now looking into getting it working with WebKit also…

But Webkit uses the w3c’s DeviceOrientation. The values appear to be totally different, but someone must have some algorithm to get it from one to the other? Or am I missing something simple?

The labyrinth game with github link
http://playground.marmaladeontoast.co.uk/labyrinth/

MozOrientation
https://developer.mozilla.org/en/Detecting_device_orientation

DeviceOrientation
http://dev.w3.org/geo/api/spec-source-orientation.html

Some sample values I have obtained:

Chrome

alpha = null                                    
beta = -178 
gamma = 4.57    

Firefox

x = 0.035999998450279236
y = -0.02800000086426735
z = 1

Any help would be greatly appreciated 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T22:25:42+00:00Added an answer on May 19, 2026 at 10:25 pm

    I’ve been playing around with this a bit. The source below ‘maps’ both alternatives to an understandable degrees range for x/gamma and y/beta.

    The MozOrientation.z value is completely different from the deviceorientation.alpha value. The first returns the vertical orientation, the latter returns a sort of compass value. These values are therefor not interchangable / convertible.

    function displayOrientation(orientData){
    
        var x = Math.round(orientData.x);
        var y = Math.round(orientData.y);
        var z = orientData.z;
    
        document.getElementById('x').value = x;
        document.getElementById('y').value = y;
        document.getElementById('z').value = z;
    }
    
    window.addEventListener("MozOrientation", function(orientData){
    
        var obj = {};
        obj.x = orientData.x * 90;
        obj.y = orientData.y * 90;
        obj.z = orientData.z;
    
        displayOrientation(obj);
    
    }, true);
    
    window.addEventListener("deviceorientation", function(orientData) {
    
        var obj = {};
        obj.x = orientData.gamma;
        obj.y = orientData.beta;
        obj.z = orientData.alpha;
    
        displayOrientation(obj);
    
    }, true);
    

    It seems the current desktop Safari (5.0.3) doesn’t support this event at all. The beta value in desktop Chrome 9 is exactly 180 less than it is in mobile Safari.
    The x & y values in Firefox and mobile Safari should be approximately the same.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically, I am using Wireshark looking at captures that have been created previously. How
I'm looking to implement a REST client in PHP, and have previously been using
I have created a visual web part that combines two other previously created web
I have created some xml layouts. Now I am creating a custom layout (in
I have to call a previously created function on SQL, like SET @ExtVALUE =
i am working on one application in which i have added 5 labels dynamically
I have previously created localhost-only RoR applications where models were created manually with scaffolds
I have just began learning Java programming, I have created a simple game using
How to get result in WITH table AS into CURSOR loop? I have previously
I have previously written user interfaces using .NET and Windows Forms. I'm about to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.