I am looking to simulate the Accelerometer on the 'desktop'. The problem is I can't seem to correctly override the values since 'accelerationIncludingGravity' or 'devicemotion' come back as 'undefined' on desktop. What I would like to do is manually set this value like so:
document.getElementById('myButton').addEventListener('click', function(){
accelerationIncludingGravity.z = 100;
});
Is there anyway to do this? I need to do this in javascript.
You need hardware or emulation for the values to be present. Google Chrome's dev tools has accelerometer emulation.
https://developer.chrome.com/devtools/docs/device-mode#device-sensors