So here’s my idea - instead of “really” calibrating it, couldn’t you just store some values from it?
Like so:
[lua]
local calibX=0
local calibY=0
local accelXGravity
local accelYGravity
local function calibrate(event)
if event.numTaps==2 then
calibX, calibY=accelXGravity, accelYGravity
end
end
Runtime:addEventListener(“tap”, calibrate)
local function accelerometerEvent(event)
accelXGravity, accelYGravity=event.xGravity, event.yGravity – The default gravity, without any calibration control
physics.setGravity(event.xGravity-calibX, event.yGravity-calibY) – Subtract calibX and calibY
end
Runtime:addEventListener(“accelerometer”, accelerometerEvent)
[/lua]
Now I just wrote that code sitting here at the reply form - not to mention I’ve never really done much with the accelerometer - so it might not work, but it seems like it should.
Caleb [import]uid: 147322 topic_id: 14690 reply_id: 143312[/import]