Ways to deal with small object oddities

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Posts: 92
Joined: Fri Apr 17, 2015 11:42 pm

Ways to deal with small object oddities

Post by mcmonkey » Sun Jul 30, 2017 7:46 am

I have a fun thing I've ignored for a while but should probably address at some point, and just remembered it now so HERE WE GO:

I have a world where 1 unit = 2/3rds a meter. (2 feet more or less).

Most objects are at least 1 unit wide on one two or all three axes.

Everything from the world objects to the character are on this scale.

... but I also have a few special cases, throwable miniobjects, that seem to make it their own duty to annoy me.

The ones I'm mainly testing with are very small cylinders, about half a unit long and much much thinner on the other two axes.

With CCD off, they fall through the ground (at ANY velocity). With it on, they almost fall through the ground then pop back up, causing them to bounce excessively until I pick them back up.

The problem is almost certainly directly linked to just the sheer tininess of the entity at hand...

Do you have any suggestions to 'stabilize' these entities, meaning make them act somewhat reasonably, other than finding an excuse to increase their size?

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

Re: Ways to deal with small object oddities

Post by Norbo » Sun Jul 30, 2017 7:23 pm

This is indeed related to the size. Cylinders don't have any special cases, so they fall back to general convex-convex contact generation. It uses incremental manifolds and iterative collision detection implementations that are sensitive to tuning.

Some options:
1) Use something like the demos ConfigurationHelper.ApplyScale. Try values below 1 for the scale to see if you can find some value that helps stabilize the small objects. On the downside, this can reduce contact quality for larger shapes, so you'll only want to go as low as necessary and no lower. Scale configuration issues tend to be far more apparent for small shapes, though.
2) If you can afford it, take more and smaller time steps. Reducing the time step duration to 1/120 from 1/60 and updating twice as often is expensive, but it can improve some issues with small objects.
3) ... Make them bigger :(

As is now tradition, the v2 side of the story for future readers:
The new version tries very hard to use one-shot manifolds whenever possible (which is looking like 'always' at this point), to avoid numerically sensitive algorithms, and to avoid scale-related tuning factors.

Combined with significantly expanded speculative contact support and more robust CCD options, it is likely that none of the above will be necessary in v2.

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests