Page 1 of 1
Instable pile of Box
Posted: Tue Jun 19, 2012 5:57 pm
by Bachmann
Hi
I've a strange problem.
I need to buid a pile of box that must be exploded by a ball.
But the pile is instable and finish by drop.
I've try a lot of thing but seems not to be efficient.
A simple algo !
Code: Select all
for (int i = 0; i < 5; i++)
{
Box box;
box = new Box(new Vector3(pos.X, i * 3f, pos.Z), 6, 3, 3, 1);
box.Material = new BEPUphysics.Materials.Material(1f, 1f, 0.0f);
Global.BepuSpace.Add(box);
}
Have you an idea ?
thank's
Re: Instable pile of Box
Posted: Tue Jun 19, 2012 6:02 pm
by Norbo
That sample code works as expected in the BEPUphysicsDemos; what behavior are you seeing, and what do you expect/want to see?
If it's just falling over after being dropped from high in the air, start the stack closer to the ground or touching it so it doesn't build up so much speed first.
Re: Instable pile of Box
Posted: Fri Jun 22, 2012 5:23 pm
by Bachmann
Thank's for this reponse.
Box are created with height=3 and their position is y= i *3
So they can't drop and get speed. But they are more and more "agitated" and about 3 or 5 seconds, they fall on the ground.
I've also modified the BEPUPhysics demo "Wall"
And I get the same issue :
Code: Select all
//float horizontalSpacing = 2.01f;
//float verticalSpacing = 1f;
//int rowCount = 7;
//int columnCount = 7;
//for (int i = 0; i < rowCount; i++)
//{
// for (int j = 0; j < columnCount; j++)
// {
// Space.Add(new Box(new Vector3(
// j * horizontalSpacing - (columnCount - i % 2) * horizontalSpacing * .5f,
// verticalSpacing * (i + 1),
// 0),
// 2, 1, 1, 20));
// }
//}
for (int i = 0; i < 10; i++)
{
Space.Add(new Box(new Vector3(
0,
i+1,
0),
1, 1, 1, 1));
}
Thank's
Re: Instable pile of Box
Posted: Fri Jun 22, 2012 5:49 pm
by Norbo
I do not see the same behavior. Using that code, the stack hits the ground, some of the upper boxes bounce due to the impact, then it quickly settles into position and in about 2-3 seconds the stack goes to sleep.
Is this using the XNA version, or a different fork? Are any configuration settings changed (Space.Solver.IterationLimit or anything else handled with the ConfigurationHelper)? Is a non-default value being used for Space.TimeStepSettings.TimeStepDuration (defaults to 1/60f, using longer time steps makes the simulation less stable)?
Re: Instable pile of Box
Posted: Fri Jun 22, 2012 5:54 pm
by Bachmann
It's a Windows Phone version. No fork ! no change in the configuration. Pile is stable for 5 box, not for 10 (i've modified my post)
Re: Instable pile of Box
Posted: Fri Jun 22, 2012 6:02 pm
by Norbo
The WP7 version of the demos sets the time step duration to 1/30f. More difficult simulations, like tall stacks, have difficulty with that duration.
If you want good stacking behavior, use a faster time step like 1/60f. It will be more expensive, but it massively improves quality.
Another option is to increase the solver quality. Try increasing the space.Solver.IterationLimit and SolverSettings.DefaultMinimumIterations. Even using 1/30f as a time step, picking 30 or so for IterationLimit and 5 or so for DefaultMinimumIterations produces stable results. Using that many iterations (three times higher than default) will be a bit expensive, but it may be cheaper than using a faster time step depending on the simulation. However, a faster time step improves quality across the board, not just in the solver.
Re: Instable pile of Box
Posted: Fri Jun 22, 2012 6:06 pm
by Norbo
I should note that a tower of single blocks, one right on top of another, is significantly more difficult than many more common simulations. As seen in the demos, the Wall works just fine with a long time step duration. Unless your simulations involve difficult circumstances, using a longer time step might be fine.
Re: Instable pile of Box
Posted: Fri Jun 22, 2012 6:54 pm
by Bachmann
Yes ! it"s why we construct house as your demo, not as my pile

Thank's for your precious advice, I will try this.
Re: Instable pile of Box
Posted: Sat Jun 23, 2012 7:15 am
by Bachmann
i've tried this :
Global.BepuSpace.TimeStepSettings.TimeStepDuration = 1 / 60f;
Global.BepuSpace.Solver.IterationLimit = 30;
SolverSettings.DefaultMinimumIterations = 10;
I get a stable pile with 8 cube and the performance keep correct.
Thank's for your help
Re: Instable pile of Box
Posted: Sat Jun 23, 2012 2:59 pm
by Norbo
It shouldn't be necessary to use both a faster time step and more solver iterations, by the way. While doing both will make it extremely stable, it will take longer to process. But if there's enough CPU time for it, it might as well be used
