I am having a problem with physics collisions using accelerometer and physics. I have a round object that i am moving with accelerometer using the objects x,y coords. When the object hits my test wall it goes half way through and if i keep tilting that way it will keep going through. Ive tried setting physics iterations and isbullet but those did not work. This device is set to landscape right, what is why i switched the xGravity and yGravity on the accelerometer function. Below is some plug and play code, thanks in advance for your help.
[lua]display.setStatusBar(display.HiddenStatusBar)
local physics = require (“physics”)
physics.start()
physics.setGravity (0, 0)
physics.setDrawMode (“hybrid”)
_w = display.contentWidth
_h = display.contentHeight
local Scene = display.newGroup ()
local starCir = display.newCircle(Scene, 0, 0, 16 )
starCir.x = 460; starCir.y = 30;
physics.addBody( starCir, “dynamic”, { radius = 16})
local accX = 0
local accY = 0
local testWall = display.newRect (Scene, 0, 0, 480, 20)
testWall.x = _w/2; testWall.y = 310;
physics.addBody ( testWall, “static”)
local onAccelerate = function (event)
accX = 20 * event.yGravity
accY = 20 * event.xGravity
end
local moveBall = function ( event )
starCir.x = starCir.x - accX
starCir.y = starCir.y - accY
end
Runtime:addEventListener (“enterFrame”, moveBall)
Runtime:addEventListener (“accelerometer”, onAccelerate)[/lua] [import]uid: 126161 topic_id: 23184 reply_id: 323184[/import]