Stellarium-web canvas navigation through device sensors

28 Views Asked by At

I would like to enhance the stellarium-web software, so that it uses the mobile devices sensors to navigate the nightsky. I managed to put together some js code to get the sensor data, but am at a loss with finding how to incorporate this in stellarium web. Can anyone point me to the file/function that needs to be called to update the view? So that I can then feed the sensor data into that? Any help would be much appreciated!

Update: To clarify, I want to build my own version from github.com/Stellarium/stellarium-web-engine, but enhance it with the device sensors.

Alright, update as requested. The following code is a simplified version (I left out the smooting for the values), but shows how I get the sensor data.

if (window.DeviceOrientationEvent) {

  function handleOrientation(event) {
    // read orientation sensors
    var alpha = event.alpha; // rotation z-axis
    var beta = event.beta;   // rotation x-axis
    var gamma = event.gamma; // rotation y-axis

    //console.log("Alpha: " + alpha + ", Beta: " + beta + ", Gamma: " + gamma);
  }

  // add Event Listener
  window.addEventListener("deviceorientation", handleOrientation, true);
} 

I do think Estus Flask is correct in his last comment, I will try that and get back here with more questions or a solution. Thanks!

0

There are 0 best solutions below