开发者

JBox2D collisions not bouncing

I have an Android application using JBox2D for physics simulation. The only dynamic object is a 0.07m radius circle, as well as several static circles and rectangles in a total game area of about 20m by 20m. I'm also using a few custom forces through the ApplyForce method.

Whenever any bodies collide, they do collide correctly howev开发者_C百科er they don't bounce; everything just thuds together. All bodies have their densities, frictions and restitutions set (some objects have a restitution greater than 1).

Does anyone have any ideas why these collisions aren't working? I think it might be because the bodies aren't moving fast enough for JBox2D to count as proper collisions (there is a cutoff in Box2D).

Thanks!


setting Settings.velocityThreshold = 0.0001f; (or very small) solved it for me.


I found a partial solution to this - Box2D (at least JBox2D) ignores restitution if the velocity is below a certain threshold - by scaling all my objects up by a factor of 10, the threshold becomes relatively lower, and objects bounce.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜