0

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 however 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!

neuropie
  • 151
  • 1
  • 10
  • This might be of help `Ball to Ball Collision - Detection and Handling` http://stackoverflow.com/questions/345838/ball-to-ball-collision-detection-and-handling – Mob Sep 24 '11 at 21:28
  • what version of the engine are you using? I would recommend trying again with the 2.1.2.2 release, this may have been fixed – Daniel Murphy Feb 12 '12 at 23:07

2 Answers2

1

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

Sergey Glotov
  • 20,200
  • 11
  • 84
  • 98
Heikki
  • 11
  • 1
0

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.

neuropie
  • 151
  • 1
  • 10