This page tests the accelerometer and gyro API in HTML5.
What I had in mind was using the phone’s accelerometer, camera, and maybe compass to interact with virtual objects. Unfortunately the phone (at least the one I have) doesn’t have a super great way to detect its own motion I think, because the accelerometers are too inexact. It’s pretty great at telling which way is down, but pretty bad at telling if it’s moving. And it totally lacks rotation sensors, although some other phones have them. The compass is too slow for pleasant AR.
Inkfood says you can get accelerometer and gyro input in HTML5, but I think my phone only has accelerometers, no gyros, and Inkfeed’s example only covers the gyros. The device orientation spec also includes accelerometer data. This browser’s DeviceOrientationEvent is , and the latest one received is none yet. This browser’s DeviceMotionEvent is , and the latest one received is none yet. As a control, the latest mousemove is none yet.
On my cellphone, this shows the alpha, beta, and gamma of the
orientation events as null, and shows motion events with new timeStamp
properties (which appear to be JS milliseconds since the Unix epoch)
all the time, and an “interval” property of “50”, meaning
50ms or 20Hz. The actual data I need is presumably in the
accelerationIncludingGravity property of the motion event, which
is none yet. The spec suggests that some
devices might not provide that property.
Empirically, that contains numerical accelerations, in meters per
second, in its properties x, y, and z. I still need to see how
sensitive that is to actual acceleration as such, to see if I can use
it to detect hand movements, or only orientation.