电晕sdk现实球从墙壁等静态物体反弹

时间:2014-07-16 22:59:58

标签: lua corona physics bounce

我希望让球弹跳得很逼真。有时它会反弹,顶点会开始减少,然后再次撞击地面并反弹甚至更高。当它撞到墙壁时也会发生同样的情况,就像墙壁违背我的意愿对球施加一个力(我没有任何力量施加到球上,除了重力,在y方向默认设置为9.8。

physics.addBody(bottomWall, "static", {density = 0, friction = 0, bounce = 0, isSensor = false})
physics.addBody(leftWall, "static", {density = 0, friction = 0, bounce = 0, isSensor = false})
physics.addBody(rightWall, "static", {density = 0, friction = 0, bounce = 0, isSensor = false})

local circle = display.newCircle( halfW, 20, 25 )
circle.x, circle.y = 160, -100
physics.addBody(circle, "dynamic", {bounce = 0.95})

1 个答案:

答案 0 :(得分:0)

尝试更改球的 linearDamping angularDamping

circle.linearDamping = 10;
circle.angularDamping = 10;