neuropie
neuropie

Reputation: 151

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

Upvotes: 0

Views: 680

Answers (2)

Heikki
Heikki

Reputation: 11

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

Upvotes: 1

neuropie
neuropie

Reputation: 151

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.

Upvotes: 0

Related Questions