Page 1 of 1

SOLVED Sphere vs. Terrain collision not happening

Posted: Tue Feb 25, 2014 3:34 pm
by sergiusz308
Hello Norbo.

I have following space setup:

Code: Select all

this.space.ForceUpdater.Gravity = new BEPUutilities.Vector3(0, -9.81f, 0f);

			Bpp.Settings.MotionSettings.DefaultPositionUpdateMode = Bpp.PositionUpdating.PositionUpdateMode.Continuous;

			this.space.Solver.IterationLimit = 10;
			Bpp.CollisionTests.CollisionAlgorithms.GeneralConvexPairTester.UseSimplexCaching = false;
			Bpp.Settings.MotionSettings.UseExtraExpansionForContinuousBoundingBoxes = false;

			Bpp.Settings.CollisionResponseSettings.MaximumPenetrationRecoverySpeed = 2;
			Bpp.Settings.CollisionResponseSettings.BouncinessVelocityThreshold = 1;
			Bpp.Settings.CollisionResponseSettings.StaticFrictionVelocityThreshold = .2f;
			Bpp.Settings.CollisionDetectionSettings.ContactInvalidationLength = .1f;
			Bpp.Settings.CollisionDetectionSettings.ContactMinimumSeparationDistance = .1f;
			Bpp.Settings.CollisionDetectionSettings.MaximumContactDistance = .1f;
			Bpp.Settings.CollisionDetectionSettings.DefaultMargin = .04f;
			Bpp.Settings.CollisionDetectionSettings.AllowedPenetration = .01f;
I'm creating sphere entity and applying impulse with about 300 magnitude.

I'm setting sphere collision rule personal to "NoSolver" - in this particular case I want contacts managed by the engine but provide my own solver.

Everything works fine except that sometimes sphere not triggering collision with terrain - there is no particular pattern when it happens. I tried switching on "ImproveBoundaryBehavior" but no luck.

I'm checking collisions in sphere's ContactCreated event - it works perfectly fine for all objects - goes through them and triggering event, but not for the terrain sometimes.

What I'm possible doing wrong here?

Thanks,
S.

Re: Sphere vs. Terrain collision not happening

Posted: Tue Feb 25, 2014 6:45 pm
by Norbo
The default MotionSettings.CCDFilter does not permit collision pairs with a NoSolver or more restrictive collision rule to undergo continuous collision detection. This is because CCD tends to cause nasty artifacts when there is no collision response, like halting briefly before continuing. So, the sphere could scoot through the world pretty easily when given a hard push.

You can override that default behavior by supplying a custom CCDFilter that just returns true. Since you plan to provide your own collision response, the artifacts shouldn't be an issue.
I tried switching on "ImproveBoundaryBehavior" but no luck.
For reference, ImproveBoundaryBehavior prevents bad contacts on the border between adjacent connected triangles. It should be on by default. It is unrelated to CCD.

Re: Sphere vs. Terrain collision not happening

Posted: Wed Feb 26, 2014 9:20 am
by sergiusz308
Thanks, this seems solved the case.