here is a plug and play code that displays my problem:
local physics = require("physics")
physics.start()
physics.setGravity(0, 0)
physics.setDrawMode( "hybrid" )
Shape1 = {127,126, 95,127, 107,75, 82,16, 86,-51, 81,-98, 88,-130}
local myRectangle = display.newRect(300, 600, 50, 100)
myRectangle:setFillColor(0, 0, 0, 0)
physics.addBody( myRectangle, "static", {density = 1.0, friction = 0, bounce = 1, isSensor = false, shape=Shape1 } )
ball = display.newCircle( 0, 0, 15 )
ball.x, ball.y = 100, 200
physics.addBody(ball, "dynamic", {density = 1, friction = 0, bounce = 1, isSensor = false, radius = 15})
ball.isBullet = true
ball:applyForce(200, 20)
local topWall = display.newRect( 0, 0, display.contentWidth, 10 )
local bottomWall = display.newRect( 0, display.contentHeight - 10, display.contentWidth, 10 )
local leftWall = display.newRect( 0, 0, 10, display.contentHeight )
local rightWall = display.newRect( display.contentWidth - 10, 0, 10, display.contentHeight )
physics.addBody(topWall, "static", {density = 1.0, friction = 0, bounce = 1, isSensor = false})
physics.addBody(bottomWall, "static", {density = 1.0, friction = 0, bounce = 1, isSensor = false})
physics.addBody(leftWall, "static", {density = 1.0, friction = 0, bounce = 1, isSensor = false})
physics.addBody(rightWall, "static", {density = 1.0, friction = 0, bounce = 1, isSensor = false})
local function resetLinearVelocity(event)
local thisX, thisY = ball:getLinearVelocity()
if thisY == 0 then
thisY = -ball.lastY
end
if thisX == 0 then
thisX = -ball.lastX
end
ball:setLinearVelocity(thisX, thisY)
ball.lastX, ball.lastY = thisX, thisY
end
local function onCollision(event)
LetterChannel = audio.play( Esound, { channel=1 })
resetLinearVelocity()
end
ball:addEventListener("collision", onCollision)
And im using the latest build 775 [import]uid: 134049 topic_id: 24245 reply_id: 98270[/import]