function init(self)
gyro.start(function(self, pitch, roll, yaw, quatx, quaty, quatz, quatw)
go.set_rotation(vmath.quat(quatx, quaty, quatz, quatw))
end)
end
function final(self)
gyro.stop()
end
The project also includes an example that uses the Defold camera extension to create an augmented reality experience:
I tested on a Samsung Galaxy S3 with the example app that comes with the extension and it works as expected. I did however come across a crash after a short while, but I’ve pushed a fix for that.
Edit: I (no, correction @Mathias_Westerdahl) figured it out. The extension uses TYPE_GAME_ROTATION_VECTOR which was made available in API Level 18 (ie Android 4.3). I’ll try to fallback to TYPE_ROTATION_VECTOR on older devices. Stay tuned!
Yep, that did the trick! I got it working on a Samsung Galaxy S2 with Android 4.0.3. I’ve pushed the new version of the extension. Please give it a try and let me know if it’s working for you as well.
I’ve added a fallback to the standard rotation vector sensor if the game rotation vector sensor isn’t available. I’ve verified that this works on an S4 Mini running Android 4.4.2. Would you mind testing on your S4 device as well?