local leftLine = display.newLine(2, 1, 2, display.contentHeight) leftLine:setColor(100, 235, 0) local topLine = display.newLine( 1, 1, display.contentWidth - 2, 1) topLine:setColor(100, 235, 0) local rightLine = display.newLine( display.contentWidth - 2, 1, display.contentWidth - 2, display.contentHeight) rightLine:setColor(100, 235, 0) local bottomLine = display.newLine( 1, display.contentHeight, display.contentWidth - 2, display.contentHeight) bottomLine:setColor(100, 235, 0) leftLine.width = 3 rightLine.width = 3 bottomLine.width = 3 topLine.width = 3 local physics = require"physics" physics.start() physics.setGravity(0, 9.8) physics.addBody( leftLine, "static", {} ) physics.addBody( rightLine, "static", {} ) physics.addBody( topLine, "static", {} ) physics.addBody( bottomLine, "static", {} ) local ball = display.newCircle( 100, 100, 12) ball:setFillColor(100, 235, 0) physics.addBody( ball, "dynamic", { bounce = .4 } ) ball:applyForce(math.random(-10, 10), math.random(-10, 10))
Here is some code i whipped u in 5 minutes to display my problem.
i have a enclosed box, with eash side haveing a physics added to it, but when i run the code
the ball will fall through a few sections of line. So far its been the bottom left corner and the bottom of the
left line that doesn’t seem to stop the ball at all and just lets it fly by.
Im no expert at Lua nor Corona SDK but if someone could explain to me why this happens it would be very
apperciated. Thank you.