Accelerometer - object get stuck at the corner

Hi,

I am playing around with Accelerometer and I use part of the code from the ShapeTumbler sample project. Below is my code:

display.setStatusBar( display.HiddenStatusBar ) local physics = require("physics") physics.start() physics.setScale( 60 ) physics.setGravity( 0, 9.8 ) -- initial gravity points downwards system.setAccelerometerInterval( 100 ) -- set accelerometer to maximum responsiveness -- Build this demo for iPhone to see accelerometer-based gravity function onTilt( event ) physics.setGravity( ( 9.8 \* event.xGravity ), ( -9.8 \* event.yGravity ) ) end Runtime:addEventListener( "accelerometer", onTilt ) local topWall = display.newRect(0,0,500, 10) topWall.anchorX = 0 topWall.anchorY = 0 topWall.x = 10 topWall.y = 10 local leftWall = display.newRect(0,0,10, 500) leftWall.anchorX = 0 leftWall.anchorY = 0 leftWall.x = 10 leftWall.y = 10 local bottomWall = display.newRect(0,0,500,10) bottomWall.anchorX = 0 bottomWall.anchorY = 0 bottomWall.x = 10 bottomWall.y = leftWall.contentHeight local rightWall = display.newRect(0,0,10,500) rightWall.anchorX = 0 rightWall.anchorY = 0 rightWall.x = topWall.contentWidth rightWall.y = 10 local circle = display.newCircle(0,0, 30) circle.x = 50 circle.y = 50 local circle1 = display.newCircle(0,0, 20) circle1.x =200 circle1.y = 110 physics.addBody(circle, {radius=circle.contentWidth/2, bounce = 0.3}) physics.addBody(circle1, {radius=circle1.contentWidth/2, bounce = 0.7}) physics.addBody(topWall, "static") physics.addBody(leftWall, "static") physics.addBody(bottomWall, "static") physics.addBody(rightWall, "static")

When I move the balls to the corner, they will get stuck there. If one ball is stuck, it can be release if another collide with it. I doubt it is physics issue rather than accelerometer issue. Anybody experience such an issue and have the solution?

Thanks.

Lin

Try tweaking the properties as suggested on https://coronalabs.com/blog/2011/08/08/solutions-to-common-physics-challenges/ still doesn’t work. I’ll try applying little force when the velocity is 0.

Lin

applying force doesn’t work either but setting isSleepingAllowed to false sort out the problem. If someone has another solution, please kindly share as well.

Lin

Try tweaking the properties as suggested on https://coronalabs.com/blog/2011/08/08/solutions-to-common-physics-challenges/ still doesn’t work. I’ll try applying little force when the velocity is 0.

Lin

applying force doesn’t work either but setting isSleepingAllowed to false sort out the problem. If someone has another solution, please kindly share as well.

Lin