I have this screen:
I want this ball to be moved using accelerometer and collide with the walls.
When I declared it as dynamic it moved but not collide, when I declared it as dynamic it had a strange trembling in its movement and after a while stop collide and went out of the borders. My code (for physics and movement function) is:
function onTilt( event )
ball.x = (ball.x + event.xGravity * 20)
ball.y=(ball.y+ event.yGravity * 20)
end
physics.addBody ( mazepart1, “static” ,physicsData:get(“mazepart1”))
physics.addBody ( mazepart1, “static” ,physicsData:get(“mazepart2”))
physics.addBody (borders, “static” ,physicsData:get(“borders”))
physics.addBody ( ball, “dynamic” ,physicsData:get(“ball1”))
Runtime:addEventListener( “accelerometer”, onTilt )
Any idea what I am doing wrong?