Simulating sand can it be done?

I have been playing around with Corona SDK and so far I have all my goals achieved but one seems beyond my reach at the moment.

I would like to simulate sand or pellets to fill a bucket. So far I have made this but it suffers greatly when 200 plus objects are created.

[lua]local someRand = math.random

local function createBB(e)
local bb = display.newCircle(10, h/2 + someRand(20), 2)
bb:setFillColor(someRand(255),someRand(255),someRand(255))
physics.addBody(bb, {density = 1.0, friction = 0.3, radius = 2})
bb.collision = onCollision
bb:addEventListener(“collision”, bb)
end

local spawn_timer = timer.performWithDelay(100, createBB, 500)

local function onCollision( event )

local otherObject = event.other
otherObject:removeSelf()
end

rect5:addEventListener( “collision”, onCollision )[/lua]

I am hoping there is a way to create a decent amount of sand particles to finish my idea.

Thanks,
Kevin
Phundroid [import]uid: 66342 topic_id: 13761 reply_id: 313761[/import]

The physics engine does start to lag when you add too many bodies to it. Reducing the frame rate to 30 fps would potentially be one way to increase the number of bodies. Another way would be to play with lowering the physics.setPositionIterations() and physics.setVelocityIterations() values (note these will reduce the accuracy of the physics engine, but will speed things up) [import]uid: 12448 topic_id: 13761 reply_id: 50522[/import]

Have you tried Particle Candy? They have some fantastic particle effects - you can just replace their images with yours and maybe tweak some of the settings to get the desired effect. [import]uid: 40033 topic_id: 13761 reply_id: 50536[/import]

I tried adjusting the settings that ChunkoutGames suggested but I am not getting the desired results.

Fava I think Particle Candy will be my next option. I just would hate to buy something if it will not work out. I guess the best route is to send them an email and see.

Thanks,
Kevin
Phundroid [import]uid: 66342 topic_id: 13761 reply_id: 50595[/import]