Gravity is not initialised when setup() is called – we’ll have to fix that. For now you can initialise it as follows:
--
function setup()
GravityYStart = 0
end
function draw()
if GravityYStart == 0 then
GravityYStart = Gravity.y
end
end
Just so you are aware, the Gravity vector is normalised to be relative to screen orientation. So if you are holding your iPad upside down, the gravity vector will still point “down” relative to the screen.