我有不同的图像作为显示对象,我希望它们在物理上以相同的速度下降。我怎样才能做到这一点?
问问题
252 次
1 回答
0
物体的密度必须相同
physics.addBody(object,"dynamic",{density = 1)
试试这段代码
local object1 = display.newRect(0,0,math.random(10,100),math.random(10,100))
object1.x = 100
object1.y = 0
physics.addBody(object1,"dynamic",{bounce = 1, friction = 0, density = 1})
local object2 = display.newRect(0,0,math.random(10,100),math.random(10,100))
object2.x = 200
object2.y = 0
physics.addBody(object2,"dynamic",{bounce = 1, friction = 0, density = 1})
由于密度的原因,尺寸随机但速度相同。
于 2013-07-26T15:07:18.893 回答