iamcsharper / bullet-xna

Automatically exported from code.google.com/p/bullet-xna
0 stars 0 forks source link

Hard tunneling #11

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
1.
I create DiscreteDynamicsWorld.If execute StepSimulation with parametrs:

StepSimulation((float)gameTime.ElapsedGameTime.TotalSeconds, 10, 1.0f / 60.f)

I get the tunneling effect. I have a ball on stage and a few 
BvhTriangleMeshShape. The ball passes through a static geometry.

If I change the update settings:
StepSimulation((float)gameTime.ElapsedGameTime.TotalSeconds, 10, 1.0f / 200.f)

There is no tunneling, the physics works fine. But the phone I can not get more 
than 2 fps.

How to eliminate the effect of tunneling.

2.
I have a couple of cylinders standing in several rows in a checkerboard 
pattern. Distance between the cylinders is enough to pass the ball between them.

But in place in order to pass the ball between the cylinders stuck in them or 
just does not pass between them. Sometimes the ball drops sharply to the left 
or right. Sometimes he stops and begins to tremble.

Tell me what the key problems.

Original issue reported on code.google.com by stm.p...@gmail.com on 13 Aug 2012 at 3:14

GoogleCodeExporter commented 9 years ago
Thanks. I'll setup a test-case to try out the problem. Have you tried enabling 
continuous collision detection (ccd) on the bodies (e.g. 
http://bulletphysics.org/mediawiki-1.5.8/index.php/Anti_tunneling_by_Motion_Clam
ping) 

Original comment by xexu...@gmail.com on 13 Aug 2012 at 7:45

GoogleCodeExporter commented 9 years ago
Thanks for your request. 
When you create your ball i set the parameters for his body:

mBallRadius = 0.95f;

mNewGeneratedBallBady.SetCcdSweptSphereRadius(mBallRadius);
mNewGeneratedBallBady.SetCcdMotionThreshold(mBallRadius);

This is correct?

Original comment by stm.p...@gmail.com on 13 Aug 2012 at 9:45

GoogleCodeExporter commented 9 years ago
What is the size of your ball object, and at what sort of speeds does it travel?

there are two values here - 
ccdMotionThreshold - if your object moves more than this value in a single 
update frame then the ccd tests will be done. (a value of 1 with a 
stepSimulation value of 60 would mean that ccd will be done if your object is 
moving at 60m/s)
ccdSweptSpehereRadius - this is an extra margin added to your object for the 
ccd checks, for an object of size 1 a value of 0.2 is recommended.

If you can attach more of your code it will help me to create a test bed.

Thanks.

Original comment by xexu...@gmail.com on 13 Aug 2012 at 10:36

GoogleCodeExporter commented 9 years ago
I could not fix the error. I send you my code.

Original comment by stm.p...@gmail.com on 15 Aug 2012 at 7:16

Attachments:

GoogleCodeExporter commented 9 years ago
Ok, 
I'm trying to just check what you've sent. One thing that looked a bit strange 
was your initial creation of the physics world in SlayerTable

PhysicsManager.CreateWorld(new Vector3(0, -9.81f * 20f, 9.81f * 8f), 1.0f, 5, 
1.0f / 200.0f);            

is it correct that you're after a gravity force of 20G downwards and 8G along Z 
?
also a simualation rate of 200fps seems high?
Is the bvh the border of the pachinko machine? does the tunnelling happen 
immediately or after the ball(s) have bounced a few times? 

What is your value for BallRadius (from the engine), I can't confirm your 
settings for ccd threshold &  ssradius until I know that.
You can also try adjusting the friction and damping values if the balls have 
too much energy in the system.

Thanks.

            float ms = 1f / 60f;
            //ms *= 0.1f;
            ///step the simulation
            if (m_dynamicsWorld != null)
            {
                m_dynamicsWorld.StepSimulation(ms, 1);

Original comment by xexu...@gmail.com on 15 Aug 2012 at 9:04

GoogleCodeExporter commented 9 years ago
My BallRadius is 0.95f.

Original comment by stm.p...@gmail.com on 21 Aug 2012 at 8:55

GoogleCodeExporter commented 9 years ago
ok those values should be fine then.
Are you using the released binaries or a checkout of the source. If the latter 
can you put a breakpoint in DiscreteDynamicsWorld.IntegrateTransforms - at the 
line :
BulletGlobals.StartProfile("CCD motion clamping");

this will confirm if it's actually getting to the CCD part of the test.

Also could you provide your vertex/index data for the tables BvhTriangleMesh?

thanks.

Original comment by xexu...@gmail.com on 22 Aug 2012 at 8:59