I have the following scene.
I want to move the ball using gravity so I wrote the following:
function onTilt( event ) deltaDegreesXText.text = "xG: " .. (9.8\*event.xGravity) deltaDegreesYText.text = "yG: " .. (-9.8\*event.yGravity) if(ball.isAwake==true)then fallAsleepText.text = "True " elseif(ball.isAwake==false)then fallAsleepText.text = "False " end physics.setGravity( ( 9.8 \* event.xGravity ), ( -9.8 \* event.yGravity ) ) end
The problem is that after some seconds the ball object fall sleep and do not move any more. In the begging of the code I have the following:
local storyboard = require( "storyboard" ) local scene = storyboard.newScene() system.setIdleTimer( false ) local physics = require "physics" local physicsData = (require "myphysics").physicsData(1.0) physics.start( true )
Any idea whats going wrong?