Making physics bodies less "bouncy" when using gameUI dragBody?

I’ve just whipped up a quick example of a “blocks” environment. Similar to the types of alphabet blocks that children would play with. I’ve tried to create a realistic environment where the canvas height is about equal to 1 meter. And the blocks are maybe 4-6 inches in height/width. It seems to work ok although when dragging and stacking they feel very “rubbery”.

If you stack them on top of one another and then click and drag down they bounce like rubber balls almost, even though their bounce parameters are set to 0.0.

I would greatly appreciate any assistance in helping me to make these less bouncy. Thank you!!!

[lua]–> ---------------------------------------------
–> Setup Display
–> ---------------------------------------------
display.setStatusBar (display.HiddenStatusBar)

–system.activate (“multitouch”)
–> ---------------------------------------------

–> ---------------------------------------------
–> Start Physics
–> ---------------------------------------------
local physics = require (“physics”)

physics.start (true)
physics.setGravity (0, 20)
physics.setScale (200)

–physics.setDrawMode (“hybrid”)
–> ---------------------------------------------

–> ---------------------------------------------
–> Enable Physics based dragging
–> ---------------------------------------------
local gameUI = require (“gameUI”)

local function dragBody (event)

–[[
gameUI.dragBody (event, {
maxForce = 20000,
frequency = 1000,
dampingRatio = 1.0
})
]]

gameUI.dragBody (event)

end
–> ---------------------------------------------

–> ---------------------------------------------
–> Create Floor
–> ---------------------------------------------
local floor = display.newRect (0, display.contentHeight, display.contentWidth, 1)

physics.addBody (floor, “static”, {
bounce = 0.1,
friction = 10.0
})
–> ---------------------------------------------

–> ---------------------------------------------
–> Create Environment Group
–> ---------------------------------------------
local environment = display.newGroup ()
–> ---------------------------------------------

–> ---------------------------------------------
–> Create block function
–> ---------------------------------------------
function newBlock ()

–> Generate random number between 20 - 60
local randWidth = math.random (40) + 20
local randHeight = math.random (40) + 20

–> Generate random x value
local randX = math.random (display.contentWidth)

local blockMaterial = {
density = 1.0,
friction = 10.0,
bounce = 0.0
}

local block = display.newRect (0, 0, randWidth, randHeight)
block.x = randX
block.y = -100
block.strokeWidth = 1
block:setStrokeColor (255, 255, 255, 255)
block:setFillColor (255, 255, 255, 128)

physics.addBody (block, blockMaterial)

block.isFixedRotation = true
–block.isBullet = true
–block.angularDamping = 20

block:addEventListener (“touch”, dragBody)

end
–> ---------------------------------------------

–> ---------------------------------------------
–> Create our blocks
–> ---------------------------------------------
local dropBlocks = timer.performWithDelay (100, newBlock, 10)
–> ---------------------------------------------[/lua] [import]uid: 10747 topic_id: 3419 reply_id: 303419[/import]

try changing the maxForce?
http://developer.anscamobile.com/forum/2010/10/26/mash-followme-and-collisiondetection [import]uid: 6645 topic_id: 3419 reply_id: 10289[/import]

I tried altering maxForce but unfortunately am still able to kind of contract and “spring” the blocks up into the air. I don’t mind there being a bit of this but just too much of it makes the blocks feel like bouncy balls :slight_smile: [import]uid: 10747 topic_id: 3419 reply_id: 10303[/import]

Try modifying friction. [import]uid: 8271 topic_id: 3419 reply_id: 10470[/import]

Try modifying friction.

I tried that even jacked it up to 1000 for the blocks but it didn’t make any difference in regards to the bounciness. Is there a way to add friction to the actual touch joint? Perhaps that would solve it? [import]uid: 10747 topic_id: 3419 reply_id: 10485[/import]

Sorry, I meant modifying it down. I have a blocks game in dev and have set all the blocks to bounce=0, friction=0. [import]uid: 8271 topic_id: 3419 reply_id: 10487[/import]

That definitely seemed to help but now they kind of slide around like ice :slight_smile:

Would you mind sharing your world settings with me?

I have mine set to:

physics.setGravity (0, 20)
physics.setScale (200)

to kind of emulate a small environment but I’m guessing it might be better to just leave the simulation as though these were “crates” and larger? Since box2D seems to have issues with smaller bodies [import]uid: 10747 topic_id: 3419 reply_id: 10491[/import]