Basic - Bad collision box vs. ground

EchoEcho
Posts: 5
Joined: Tue Jul 20, 2010 5:22 pm

Basic - Bad collision box vs. ground

Post by EchoEcho »

I have basic question. Where is the problem? :D

I run example Hello World from this page: http://www.bulletphysics.org/mediawiki- ... ello_World
and everything is OK.

but I change only this row:
btCollisionShape* fallShape = new btSphereShape(1);

from this:
btVector3 size = btVector3(1,1,1);
btCollisionShape* fallShape = new btBoxShape(size / 2);

and I have unexpected result where the box has not accurate collision with the ground :evil: .

so what I missed???



results:

sphere height: 22.1917
sphere height: 21.7972
sphere height: 21.4
sphere height: 21
sphere height: 20.5972
...
...
...
sphere height: 2.72224
sphere height: 2.20835
sphere height: 1.69168
sphere height: 1.17224
sphere height: 0.650017
sphere height: 0.125018
sphere height: -0.236477
sphere height: -0.040607
sphere height: 0.152485
sphere height: 0.3428
sphere height: 0.530336
sphere height: 0.715095
sphere height: 0.897076
sphere height: 1.07628
sphere height: 1.25271
....
EchoEcho
Posts: 5
Joined: Tue Jul 20, 2010 5:22 pm

Re: Basic - Bad collision box vs. ground

Post by EchoEcho »

nobody :(

I really do not know, maybe I wrong compiled bullet. Is it support 64bit and window 7?
EchoEcho
Posts: 5
Joined: Tue Jul 20, 2010 5:22 pm

Re: Basic - Bad collision box vs. ground

Post by EchoEcho »

all right, I have little progress:

I think that solution is in stepsimulation, so I delete:

Code: Select all

dynamicsWorld->stepSimulation(1/60.f,10);
and write this:

Code: Select all

float time = 1/60.f;
int substeps = 100;

for (int j=0 ; j<substeps ; j++) {
    dynamicsWorld->stepSimulation(time/(float)substeps,0);
}
if I put substeps to 10, I get result suchlike dynamicsWorld->stepSimulation(1/60.f,10), but with 100 is OK.


BUT, problem is that if I have more boxes, that there is old problem !!!


SomeWhere I read that bullet compute one contact point while one substep, but with 1000 box object this is really slow down simulation time.

So again Where is problem???
EchoEcho
Posts: 5
Joined: Tue Jul 20, 2010 5:22 pm

Re: Basic - Bad collision box vs. ground

Post by EchoEcho »

oki, my bad, thx :?