Ball crosses wall for a very short period of time.
-
- Posts: 10
- Joined: Sat Feb 23, 2013 11:33 am
Ball crosses wall for a very short period of time.
In my scene I have btBvhTriangleMeshShape representing walls and btSphereShape representing ball. On sphere I use setLinearVelocity method. The ball moves just fine in all directions, except for that one frame where ball appears to have passed through the wall, but on next frame it goes back, right besideds the wall. How to solve this issue? If I increase velocity twice ball goes through wall, but that's another common problem, not exactly the one I'm facing.
You do not have the required permissions to view the files attached to this post.
-
- Posts: 225
- Joined: Wed Jan 07, 2009 11:43 am
- Location: London
Re: Ball crosses wall for a very short period of time.
That will probably be down to how fast the ball is moving and 'jumping' through the mesh. What you might want to try is setting up continuous collision detection (CCD) , which should help prevent this. Theres a CcdPhysicsDemo as one of the standard bullet demos that should help you get it set up.
-
- Posts: 10
- Joined: Sat Feb 23, 2013 11:33 am
Re: Ball crosses wall for a very short period of time.
Hey, thanks for suggestion.
I added these to my sphere body:
So the problem didn't went away. There's still this one frame rendered with part of the ball being seen passing through wall. What it did changed though is that now I can multiply balls speeds 10 times and it still doesn't go through the wall 
I'm not sure what values I was supposed to add. My sphere radius is 2.5f.
I added these to my sphere body:
Code: Select all
body->setCcdMotionThreshold(1.0f);
body->setCcdSweptSphereRadius(0.4f);

I'm not sure what values I was supposed to add. My sphere radius is 2.5f.