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 8360055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:20:39+00:00 2026-06-09T11:20:39+00:00

I have a web application I am trying to show a plane of map

  • 0

I have a web application I am trying to show a plane of map image tiles in a 3D space.

I want the plane to be always horizontal however the device rotate, the final effect is similar to this marine compass demo.

I can now capture device orientation through the W3C device orientation API for mobile devices, and I successfully rendered the map image tiles.

My problem is me lacking of essential math knowledge of how to rotate the camera correctly according to the device orientation.

I am using the Three.js library. I tried to set rotation of the camera object directly by the alpha/beta/gamma (converted to radian). But it’s not working since the camera seems to always rotate according to the world axis used by openGL/webGL not according to its local axis.

I came across the idea of rotate a point 100 unit in front the camera and rotate the point relatively to the camera position by angles supplied by the device orientation API. But I don’t know how to implement this either.

Can anyone help me with what I want to achieve?

EDIT:

MISTAKE CORRECTION:

For anyone interested in implementing similar things, I found out that Three.js objects uses local space axis by default, not world space axis, I was wrong. Though the official document stated that by setting “object.matrixAutoUpdate = false” and then modify “object.matrixWorld” and call “object.updateWorldMatrix()” you can manually move/rotate/scale the object in world axis. However it does not work when the object has a parent, the local axis matrix will always be used when the object has a parent.

  • 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-06-09T11:20:41+00:00Added an answer on June 9, 2026 at 11:20 am

    According to the W3C Device Orientation Event Specification, the angles alpha, beta and gamma form a set of intrinsic Tait-Bryan angles of type Z-X’-Y”.

    The Three.js camera also rotates according to intrinsic angles. However the default order in which the rotations are applied is:

    camera.rotation.order = 'XYZ'.
    

    What you need to do, then, is to set:

    camera.rotation.order = 'ZXY'; // or whatever order is appropriate for your device
    

    You then set the camera rotation like so:

    camera.rotation.x = beta * Math.PI / 180;
    camera.rotation.y = gamma * Math.PI / 180;
    camera.rotation.z = alpha * Math.PI / 180;
    

    Disclaimer: I do not have your device type. This is an educated guess based on my knowledge of three.js.

    EDIT: Updated for three.js r.65

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

Sidebar

Related Questions

I have a web application project. I am trying to find out why certain
I have something I am trying to achieve. I have a web application running
I am trying to build a web application, where I have abstracted logic in
I'm trying to develop a web application with Novell LDAP Authentication . I have
Here's what I'm trying to do. I have an ASP.NET MVC web application, where
I am trying to call a web service from asp.net 3.5 application. I have
I have web application and I do not really care about IE6 users. However
My web application is based on Google Maps API and I have problems trying
I'm trying to deploy my mvc app into my large web application. I have
this is kind of tricky: I have an C# web application running always on

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.