Search code examples
javascriptdebuggingthree.jsorientationmotionevent

How to emulate mobile device gyro (deviceorientation event) on desktop browser for debugging purposes?


I'm trying to add mobile device orientation events in a threejs web project, but I'm puzzled as to how I can get a proper debug loop going for testing motion controls on desktop. Even just some console logging on orientation events would probably be enough. What is the best way to simulate this on desktop?


Solution

  • I found a function to do exactly this in Chromium developer tools. Open Developer Tools from the menu, then dot menu > More tools > sensors. A tab will open that allows you to emulate rotation of a mobile device by clicking on the image. This is exactly what I was looking for!

    sensors