Page 1 of 1

Bug with Continuous detection and NoSolver

Posted: Tue Jun 09, 2015 7:28 am
by test44x
Hi Norbo,


While working on app for mobile devices I encountered what seems to be a bug. A collision problem occurs when continuous collision detection is set and compound child is set to NoSolver.

I was trying to use each children of a compound object to act as triggers by setting them to NoSolver when coins are picked up on the map. But when every time a player moves through the coins to pick them up, the player would get stuck for few frames then continue to move.

At first I thought it was a bug introduced when I converted BEPU to use FixedMath to be cross-platform deterministic, but after spending few painful hours of wondering why it's doing that, it turns out that it's because continuous collision detection.

Here is the code to reproduce it:

Code: Select all


MotionSettings.DefaultPositionUpdateMode = BEPUphysics.PositionUpdating.PositionUpdateMode.Continuous;

            List<CompoundChildData> tmpList = new List<CompoundChildData>();

            CompoundChildData boxChild = new CompoundChildData();
            boxChild.Entry = new CompoundShapeEntry(new BoxShape(10, 1, 10), new Vector3(0, 0, 0));
            boxChild.CollisionRules = new CollisionRules { Personal = CollisionRule.Normal };
            tmpList.Add(boxChild);

            for(int i = 0; i < 4; i ++)
            {
                CompoundChildData cylinderChild = new CompoundChildData();
                cylinderChild.Entry = new CompoundShapeEntry(new CylinderShape(0.5f, 1), new Vector3(0, 2 + (2 * i), 0), 0);
                cylinderChild.CollisionRules = new CollisionRules { Personal = CollisionRule.NoSolver };
                tmpList.Add(cylinderChild);
            }

            compChildern = new CompoundBody(tmpList);
            Space.Add(compChildern);

            fallingBall = new Sphere(new Vector3(0, 14, 0), 1, 1);
            Space.Add(fallingBall);

            fallingBall2 = new Sphere(new Vector3(-3, 14, 0), 1, 1);
            Space.Add(fallingBall2);
You will see the ball on the right side make collisions or appear to make collisions with the child of compound that's set to NoSolver. Normally the balls should fall exactly the same way side by side each other. if you set collision detection to Discrete you will see both balls behave as it's suppose to.

Hope this helps you, took me a while to find the bug.
Once again, thanks for the great engine.

Re: Bug with Continuous detection and NoSolver

Posted: Tue Jun 09, 2015 7:29 pm
by Norbo
Thanks for the report and repro! Compound pair handlers weren't taking into account the CCDFilter; it should be fixed now.

Re: Bug with Continuous detection and NoSolver

Posted: Tue Jun 09, 2015 10:34 pm
by test44x
Awesome - everything works great now, there is also slight performance increase.

Thanks for the quick fix!