I created a test level with just the player (a glorified sphere primitive), a platform (a kinematic box primitive), and a detectorvolume to teleport the player back to his spawn point should he fall off.
The player's physics properties change based on items he picks up, and the variables include, but are not limited to: mass, gravity (the player should be the only object affected by gravity, so I just change the space's gravity), friction, and bounciness.
In order to test some factors, I created a data set that kept everything constant except gravity and bounciness, which I tested separately. I normally use a composite bounciness function that looks like this:
Code: Select all
float compositeBounciness(Entity entityA, Entity entityB, float bounceA, float bounceB, object extraInfo)
{
float retVal = bounceA * bounceB;
return retVal;
}
But instead opted to use it to specify a specific bounciness for the testing.
Gravity Set
To test gravity, I had compositeBounciness return 0.5f. I tested gravity in the set
Vector3.Up * {-1 ... -20} in whole number increments. With the ball at rest, it would begin to jitter when gravity hit -13, and would continue to jitter until it dropped back down to -6. When dropped, the ball would jitter when gravity was stronger than -6 (-7 ... -20).
Bounciness Set
To test bounciness, I had compositeBounciness return my control variable, which ranged from 0.1 to 0.8, and tested 2 different values of gravity (-5 and -10). With the ball at rest, no amount of bounciness (within my test set) would generate jitter. When dropped from a height, gravity of -5 would generate jitter with bounciness > 0.5, and gravity of -10 would generate jitter with bounciness > 0.3.
My simulation settings look like this:
Code: Select all
space = new Space();
#if XBOX360
//Note that not all four available hardware threads are used.
//Currently, BEPUphysics will allocate an equal amount of work to each thread.
//If two threads are put on one core, it will bottleneck the engine and run significantly slower than using 3 hardware threads.
space.threadManager.add(delegate(object information) { Thread.CurrentThread.SetProcessorAffinity(new int[] { 1 }); }, null);
space.threadManager.add(delegate(object information) { Thread.CurrentThread.SetProcessorAffinity(new int[] { 3 }); }, null);
space.threadManager.add(delegate(object information) { Thread.CurrentThread.SetProcessorAffinity(new int[] { 5 }); }, null);
space.useMultithreadedUpdate = true;
#else
if (Environment.ProcessorCount > 1)
for (int i = 0; i < Environment.ProcessorCount; i++)
space.threadManager.add();
space.useMultithreadedUpdate = true;
#endif
space.simulationSettings.timeStep.useInternalTimeStepping = true;
space.simulationSettings.timeStep.timeStepDuration = 1 / 60f;
space.simulationSettings.timeStep.timeScale = 5f;
space.simulationSettings.collisionDetection.collisionDetectionType = CollisionDetectionType.linearContinuous;
space.simulationSettings.collisionDetection.bouncinessBlender = compositeBounciness;
I didn't notice I was a few versions behind, so I just updated to 0.14.1, and am still having the same issues.