Bug with Continuous detection and NoSolver

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
test44x
Posts: 15
Joined: Tue Jan 20, 2015 1:40 am

Bug with Continuous detection and NoSolver

Post 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.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Bug with Continuous detection and NoSolver

Post by Norbo »

Thanks for the report and repro! Compound pair handlers weren't taking into account the CCDFilter; it should be fixed now.
test44x
Posts: 15
Joined: Tue Jan 20, 2015 1:40 am

Re: Bug with Continuous detection and NoSolver

Post by test44x »

Awesome - everything works great now, there is also slight performance increase.

Thanks for the quick fix!
Post Reply