Hi,
I started trying out Corona 2 hours ago so I’m kind of green and this is probably a dumb question, but here goes…
I’m not entirely satisfied with how the physics seems to work in the example below:
local physics = require("physics") physics.start() local ground = display.newRect(display.contentWidth / 2, display.contentHeight-20, display.contentWidth, 3) physics.addBody(ground, "static", { density=1.0, friction=0.5, bounce=0.0}) local function spawnCoins() local coin = display.newImage("coin.png") coin.x = math.random(display.contentWidth/8) + display.contentWidth/2 coin.y = -50 physics.addBody(coin, { density=2.0, friction=0.3, bounce=0.3}) end timer.performWithDelay(250, spawnCoins, 15)
The result of this code is a pile of coins, but more often than not many of them are floating a bit above the coin below for some reason (see the physics.jpg image).
The coin.png image is 60x60 pixels and I’ve set the physics radius to 30. I would have thought that this would ensure some quite nice collisions.
Am I making a simple mistake or is the coin.png image wrong or is this just what we can expect from the physics engine?