Re: Gyroscope/DeviceMotion events

On 24/08/2010, at 3:51 AM, Steve Block wrote:

> I've updated the spec to rename AccelerometerEvent to
> DeviceMotionEvent and add the gyroscope data. Note that I decided to
> use objects for each of the sets of acceleration, acceleration
> including gravity and rotation rate data, to keep the API clean.

I suggest extracting gravity out to a separate vector attribute, rather than combining it with acceleration. I expect more people would want to know the direction of gravity, so might as well make it easy for them to get it. Also, it means that can be clearly null while it is being calculated.

Along these lines, I wonder if DeviceOrientation should have a flag to indicate whether or not it is real-world accurate. For example, some hardware might be able to accurately return orientation changes but not have a compass. This is still extremely useful in games, where they don't necessarily care about real-world orientation, but rather the change in orientation. Also, even with devices that do have a compass, the real-world orientation might take a little while to calculate - yet it could return DeviceOrientation events immediately.

PS. You should update the date on the spec.

Dean

Received on Monday, 23 August 2010 23:20:05 UTC