Cylinder Hover Bug :(

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
Wowo
Posts: 6
Joined: Wed Jun 01, 2011 3:29 pm

Cylinder Hover Bug :(

Post by Wowo »

If I set a cylinder's height to 1, BEPU seems to treat it like the height is about 1.1, cylinder's will seem to 'hover' above a box or another cylinder instead of falling flat. The boxes and sphere's seem to work. All in all it seems to be working reasonably well though...
Wowo
Posts: 6
Joined: Wed Jun 01, 2011 3:29 pm

Re: Cylinder Hover Bug :(

Post by Wowo »

I see there's a fork that Ross os actively working on, I'll see if this is fixed....
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Cylinder Hover Bug :(

Post by Norbo »

It is not a bug; that's caused by the collision margin. An explanation of how they work can be found here: http://www.bepu-games.com/forums/viewto ... ?f=4&t=409

The link is very old so the fields it refers to are gone, but the concepts are the same.

Boxes automatically include the collision margin within their shape. In collisions where there is no special case, this shows up as a slight rounding on corners. In box-box and box-sphere, there is a special case which uses the exact shapes.

A sphere is actually a point with a collision margin equal to its radius. Similarly, a Capsule is a line with a collision margin equal to its radius.

Other shapes, including cylinders, use an external collision margin. To compensate for this, you can increase the size of the graphic. For simplicity, the debug drawer does not bother expanding the graphic to include collision margins for most shapes.

The CollisionDetectionSettings.DefaultCollisionMargin is set to 0.04. When two arbitrary convex objects collide, there will be a combined margin of 0.08. You can decrease this default if you'd like, though it can lower simulation quality and performance depending on the situation. Individual convex shapes can have their collision margins changed as well.
Wowo
Posts: 6
Joined: Wed Jun 01, 2011 3:29 pm

Re: Cylinder Hover Bug :(

Post by Wowo »

I pulled the latest fork, it still hovers. I'm using cylinders with a radius of 1 and height of 1. I'm just starting them up in the air with gravity on, they all seem to hover.
Wowo
Posts: 6
Joined: Wed Jun 01, 2011 3:29 pm

Re: Cylinder Hover Bug :(

Post by Wowo »

Oops, didn't see the reply...
Wowo
Posts: 6
Joined: Wed Jun 01, 2011 3:29 pm

Re: Cylinder Hover Bug :(

Post by Wowo »

I'm going to carry on with other things, if you get a chance see if you can tweak this some, the hovering is pretty bad with cylinders...
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Cylinder Hover Bug :(

Post by Norbo »

It won't be fundamentally changed any time soon, if ever. The collision margin allows some very useful algorithms to be used. The margin may be made internal instead of external (subtracting height and radius so that, at corners, the shape is actually smaller than expected instead of larger all over), but that doesn't really change anything. It is practically equivalent to increasing the size of the graphic.

Edit:
And the engine is open source, so you could choose to make the margins internal if you would like to as well :)
Wowo
Posts: 6
Joined: Wed Jun 01, 2011 3:29 pm

Re: Cylinder Hover Bug :(

Post by Wowo »

Ya OK. I've got BEPU integrated into my app and it seems to be working pretty well for the most part so I'll likely help out in upgrading it as time goes on.
Post Reply