Bepu v2: Adding bounciness to ColosseumDemo

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
filnet
Posts: 1
Joined: Mon May 27, 2019 3:25 pm

Bepu v2: Adding bounciness to ColosseumDemo

Post by filnet » Mon May 27, 2019 3:32 pm

Hi,

I am trying, whithout success, to add bounciness to the ColosseumDemo.

Currently the balls will not bounce on the ground when hitting it. They will stick to ground and roll away at quite some speed.

I understand that it needs to be done in the callbacks but my tweakings were fruitless.
How would one make the ball bounce ?

Cheers,
Philippe.

Norbo
Site Admin
Posts: 4661
Joined: Tue Jul 04, 2006 4:45 am

Re: Bepu v2: Adding bounciness to ColosseumDemo

Post by Norbo » Mon May 27, 2019 8:05 pm

Bounciness that works like the usual coefficient of restitution doesn't currently exist: https://github.com/bepu/bepuphysics2/issues/52

Something that looks sorta-kinda-bouncy-sometimes can indeed be done by messing with the Frequency and DampingRatio. You'll want a small or zero DampingRatio and a high frequency.

But there will be problems:
1) Speculative contacts will kill part of the approach velocity without contributing to any bounce. You'll likely have to shrink the speculative margin. It should still be positive to avoid potential jitter. Unfortunately, this means that you lose the continuous collision detection effect of speculative margins. Even the full continuous collision detection approach uses speculative contacts so it won't work like you want either.
2) To get something approximating your desired bounciness, you might need very high Frequency values. This can cause instability when dealing with complex simulations like piles of objects; generally you want to choose Frequency values that are no larger than 0.5 / TimestepDuration. (In other words, a frequency of 30 at 60hz simulation update rate.) To achieve stability with higher frequency values, you'll likely need to decrease the timestep duration and increase the update rate to compensate.

The best outcome still won't be what you'd expect from a coefficient of restitution, though. This all comes down to an incompatibility between speculative contacts and the typical bounciness formulation. There are potential solutions, but they're all a bit ugly and I didn't ship them with the first version of v2.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 7 guests