Hey guys, quick question about gravity settings?

If I have multiple objects on screen and I already set gravity to a set amount, can I make one of the objects to be affected by lets say 3x the already set value of gravity?
Thanks again in advance [import]uid: 35535 topic_id: 10299 reply_id: 310299[/import]

no but some work around

  1. apply some different amount of force to down side to all the objects

  2. set gravity very high and apply linearDamping to objects

as well as some others

:slight_smile: [import]uid: 12482 topic_id: 10299 reply_id: 37570[/import]

Thanks for the reply! Do you mind explaining the first method for me? or just put down the line of code so I can find it in the API? Thanks. [import]uid: 35535 topic_id: 10299 reply_id: 37574[/import]

sure here is the code for first

[lua]local physics = require “physics”
physics.start()

local rects = {}

rects[1] = display.newRect(0,0,100,100)

rects[2] = display.newRect(150,0,100,100)

rects[3] = display.newRect(300,0,100,100)

for i=1,#rects do
physics.addBody(rects[i])
end

rects[2]:applyForce(0,100,rects[2].x,rects[2].y)
rects[3]:applyForce(0,50,rects[3].x,rects[3].y)[/lua] [import]uid: 12482 topic_id: 10299 reply_id: 37577[/import]

and for the second

[lua]local physics = require “physics”
physics.start()
physics.setGravity(0,50)

local rects = {}

rects[1] = display.newRect(0,0,100,100)

rects[2] = display.newRect(150,0,100,100)

rects[3] = display.newRect(300,0,100,100)

for i=1,#rects do
physics.addBody(rects[i])
end
rects[2].linearDamping = 5
rects[3].linearDamping = 2[/lua]

:slight_smile: [import]uid: 12482 topic_id: 10299 reply_id: 37578[/import]

Thank You :smiley: [import]uid: 35535 topic_id: 10299 reply_id: 37738[/import]

welcome

:slight_smile: [import]uid: 12482 topic_id: 10299 reply_id: 37748[/import]