Objects falling at same speed?

Hi

this is the code:

--\> Start Physics physics = require ("physics") physics.start() physics.setContinuous( false ) physics.setScale( 30 ) physics.setGravity (0, 10) physics.setDrawMode ("hybrid") local rectangle = display.newRect( 20 , 100, 8, 30 ) physics.addBody( rectangle, "dynamic", {density=10, friction=0.5, bounce=0.8 } ) local circle = display.newCircle( 50, 100, 10 ) physics.addBody( circle, "dynamic", {density=0.1, friction=0.5, bounce=0.8, radius = 10 } )

Although rectangle and circle have different density, they are falling at the same speed. How can I change this? Thank you.

Hi tomaz,

I think you can start them at difernet height or start the second using timer… also I found this works as well

circle.linearDamping = 1

[lua]

–> Start Physics
physics = require (“physics”)
physics.start()
physics.setContinuous( false )
–physics.setScale( 30 )
physics.setGravity (0,10)
physics.setDrawMode (“hybrid”)

local rectangle = display.newRect( 20 , 100, 8, 30 )
physics.addBody( rectangle, “dynamic”, {density=10, friction=0.5, bounce=0.8 } )

local circle = display.newCircle( 50, 100, 10 )
physics.addBody( circle, “dynamic”, {density=0.1, friction=0.5, bounce=0.8, radius = 10 } )

circle.linearDamping = 1

[/lua]

its working, thank you alzaabi98. 

just one more question, maybe more for the Corona guys, shouldn’t be desnity enough?

density (optional)

Number. Multiplied by the area of the body’s shape to determine mass. Based on a standard value of 1.0 for water. Lighter materials (such as wood) have a density below 1.0, and heavier materials (such as stone) have a density greater than 1.0. Default value is 1.0.

Box2D is recreating real physical world so this behaviour is normal! In box2d there is no “air” in your world, so like in vacuum conditions, all object falls with the same speed regardless of the mass (size and density).

.linearDamping gives you “simulated” resistance of the air.

If no air resistance is present, the rate of descent depends only on how far the object has fallen, no matter how heavy the object is. This means that two objects will reach the ground at the same time if they are dropped simultaneously from the same height. This statement follows from the law of conservation of energy and has been demonstrated experimentally by dropping a feather and a lead ball in an airless tube.

When air resistance plays a role, the shape of the object becomes important. In air, a feather and a ball do not fall at the same rate. In the case of a pen and a bowling ball air resistance is small compared to the force a gravity that pulls them to the ground. Therefore, if you drop a pen and a bowling ball you could probably not tell which of the two reached the ground first unless you dropped them from a very very high tower.  

thank you piotrz55 for clearing this to me. :slight_smile: I appreciate it…

Hi tomaz,

I think you can start them at difernet height or start the second using timer… also I found this works as well

circle.linearDamping = 1

[lua]

–> Start Physics
physics = require (“physics”)
physics.start()
physics.setContinuous( false )
–physics.setScale( 30 )
physics.setGravity (0,10)
physics.setDrawMode (“hybrid”)

local rectangle = display.newRect( 20 , 100, 8, 30 )
physics.addBody( rectangle, “dynamic”, {density=10, friction=0.5, bounce=0.8 } )

local circle = display.newCircle( 50, 100, 10 )
physics.addBody( circle, “dynamic”, {density=0.1, friction=0.5, bounce=0.8, radius = 10 } )

circle.linearDamping = 1

[/lua]

its working, thank you alzaabi98. 

just one more question, maybe more for the Corona guys, shouldn’t be desnity enough?

density (optional)

Number. Multiplied by the area of the body’s shape to determine mass. Based on a standard value of 1.0 for water. Lighter materials (such as wood) have a density below 1.0, and heavier materials (such as stone) have a density greater than 1.0. Default value is 1.0.

Box2D is recreating real physical world so this behaviour is normal! In box2d there is no “air” in your world, so like in vacuum conditions, all object falls with the same speed regardless of the mass (size and density).

.linearDamping gives you “simulated” resistance of the air.

If no air resistance is present, the rate of descent depends only on how far the object has fallen, no matter how heavy the object is. This means that two objects will reach the ground at the same time if they are dropped simultaneously from the same height. This statement follows from the law of conservation of energy and has been demonstrated experimentally by dropping a feather and a lead ball in an airless tube.

When air resistance plays a role, the shape of the object becomes important. In air, a feather and a ball do not fall at the same rate. In the case of a pen and a bowling ball air resistance is small compared to the force a gravity that pulls them to the ground. Therefore, if you drop a pen and a bowling ball you could probably not tell which of the two reached the ground first unless you dropped them from a very very high tower.  

thank you piotrz55 for clearing this to me. :slight_smile: I appreciate it…