Rolling friction.
-
- Posts: 22
- Joined: Mon Dec 19, 2005 3:15 pm
Rolling friction.
Hi, I have a pool game running with bullet. Unfortunately the balls never come to rest as there is nothing to slow them down to a stop. I've changed the friction values of the ball and table but the balls never comes to rest. Does bullet implement "rolling friction"? If not a sphere shape will carry on rolling forever! I've also tried using the damping calls, but these don't slow the balls to a standstill either.
Any ideas?
Thanks,
Steve.
Any ideas?
Thanks,
Steve.
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
-
- Posts: 22
- Joined: Mon Dec 19, 2005 3:15 pm
Hi Erwin,
The reason the damping was failing to have an effect is that I was scaling all my objects / positions / masses / gravity up by a factor of 100 in order to get the collision to a reasonable level of accuracy. The damping appears to have no effect after this.
I have a few more questions I hope you can answser (Sorry!) :
1. I am simulating this pool game, unfortunately due to the real world sizes of the objects, the balls judder (bounce up and down slightly) on the table and never come to rest. No matter how much I scale up my world 10x, 100x, 1000x) they still vibrate. How can I stop this? I even tried using the ODE solver, which yielded very odd effects...
2. I have to scale up my world (say by a factor of 100x) to get the collsion working. This causes the damping to stop having and effect. Should this be so?
3. Shouldn't a rolling ball with no damping, come to a rest due to the energy being lost by friction? I've set friction values and the balls just keep on rolling.
4. This scaling up for the physics / down for the graphics seems a bit hacky Can you think of a better way? I'd have thought box/sphere would not need a collision tollorence, unless this is an integration issue rather than an intersection issue...
As ever, many thanks for your continuing help.
Steve.
The reason the damping was failing to have an effect is that I was scaling all my objects / positions / masses / gravity up by a factor of 100 in order to get the collision to a reasonable level of accuracy. The damping appears to have no effect after this.
I have a few more questions I hope you can answser (Sorry!) :
1. I am simulating this pool game, unfortunately due to the real world sizes of the objects, the balls judder (bounce up and down slightly) on the table and never come to rest. No matter how much I scale up my world 10x, 100x, 1000x) they still vibrate. How can I stop this? I even tried using the ODE solver, which yielded very odd effects...
2. I have to scale up my world (say by a factor of 100x) to get the collsion working. This causes the damping to stop having and effect. Should this be so?
3. Shouldn't a rolling ball with no damping, come to a rest due to the energy being lost by friction? I've set friction values and the balls just keep on rolling.
4. This scaling up for the physics / down for the graphics seems a bit hacky Can you think of a better way? I'd have thought box/sphere would not need a collision tollorence, unless this is an integration issue rather than an intersection issue...
As ever, many thanks for your continuing help.
Steve.
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
You shouldn't have to scale up objects.
Can you please reproduce your setup (table and balls) with the sizes you want in a Bullet Demo (which shows the jitter?). Without scaling or overriding default margins if possible. What is the timestep you use?
With this info, I can try to resolve this issue,
Thanks,
Erwin
Can you please reproduce your setup (table and balls) with the sizes you want in a Bullet Demo (which shows the jitter?). Without scaling or overriding default margins if possible. What is the timestep you use?
With this info, I can try to resolve this issue,
Thanks,
Erwin
-
- Posts: 3
- Joined: Tue Feb 27, 2007 8:53 am
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
-
- Posts: 22
- Joined: Mon Dec 19, 2005 3:15 pm
-
- Posts: 24
- Joined: Mon Aug 04, 2008 3:54 pm
Re: Rolling friction.
Wait, so the rolling friction issue just went away then?
I'm also looking at Bullet for a pool/billiards game. I have already created such using Newton Game Dynamics but now I'd like to evaluate Bullet.
In NGD I used a custom joint for "dry rolling friction". I'm no physics genius by any stretch but the idea was that a perfect sphere will only contact a flat surface at one point and thus friction doesn't have much influence. Thus, the balls roll for a very long time. The dry rolling friction joint somehow simulated the fact that in reality a sphere will touch a surface in multiple points, forming a contact patch, with > 1 contact points. Thus, there's more influence from friction and thus the balls do stop rolling eventually (based on your friction coefficients, etc.)
Does Bullet support dry rolling friction (why it's "dry" I don't know) out of the box? I see no mention by the original poster of using anything custom to get the balls to stop rolling.
http://newtondynamics.com/forum/viewtop ... tion#p8158
I'm also looking at Bullet for a pool/billiards game. I have already created such using Newton Game Dynamics but now I'd like to evaluate Bullet.
In NGD I used a custom joint for "dry rolling friction". I'm no physics genius by any stretch but the idea was that a perfect sphere will only contact a flat surface at one point and thus friction doesn't have much influence. Thus, the balls roll for a very long time. The dry rolling friction joint somehow simulated the fact that in reality a sphere will touch a surface in multiple points, forming a contact patch, with > 1 contact points. Thus, there's more influence from friction and thus the balls do stop rolling eventually (based on your friction coefficients, etc.)
Does Bullet support dry rolling friction (why it's "dry" I don't know) out of the box? I see no mention by the original poster of using anything custom to get the balls to stop rolling.
http://newtondynamics.com/forum/viewtop ... tion#p8158
-
- Posts: 141
- Joined: Mon Jul 02, 2007 5:12 pm
Re: Rolling friction.
There is no native support for rolling friction in Bullet. You will have to cook up a custom solution. There are numerous threads about this in various corners of this forum. I approximated this myself by applying a scaled impulse to the sphere based on its velocity. It works well enough, although there are some edge cases that had to be handled.
- Alex
- Alex
-
- Posts: 24
- Joined: Mon Aug 04, 2008 3:54 pm
Re: Rolling friction.
OK. I perused the other relevant threads. The R&D thread about this is over my head a bit.
Maybe this is a dumb idea but would using a tri mesh shaped like a sphere be better? There would be more contact points touching the surface of the table this way. I'll have at most 16 such tri mesh collision shapes so I don't think performance would be a problem.
Thoughts? Other tips?
Maybe this is a dumb idea but would using a tri mesh shaped like a sphere be better? There would be more contact points touching the surface of the table this way. I'll have at most 16 such tri mesh collision shapes so I don't think performance would be a problem.
Thoughts? Other tips?
-
- Posts: 141
- Joined: Mon Jul 02, 2007 5:12 pm
Re: Rolling friction.
That's certainly an option. Someone on one of these threads mentioned that the folks at Valve used convex hulls like you mention to model the barrels in Half Life 2, thereby giving them friction, so it seems like a good alternative. I'm not sure about performance and realism, but I suppose you can let us know
- Alex
- Alex
-
- Posts: 24
- Joined: Mon Aug 04, 2008 3:54 pm
Re: Rolling friction.
I read that barrel thread earlier today. I suppose that is where I got the idea from, without consciously realizing it.
I will try this out in a demo app. It'll be my first with Bullet.
I will try this out in a demo app. It'll be my first with Bullet.
-
- Posts: 508
- Joined: Fri May 30, 2008 2:51 am
- Location: Ossining, New York
Re: Rolling friction.
Angular damping seems like the best approach to me. Perhaps it would be nice if it depended on the surface in question, e.g. a pool ball rolling over grass should stop quicker than a ball rolling over polished metal. Rolling friction is caused by the squashing and unsquashing of the surface as the ball rolls over it, it doesn't really have much to do with conventional friction. More conventional friction causes the ball to start rolling earlier though.
-
- Posts: 24
- Joined: Mon Aug 04, 2008 3:54 pm
Re: Rolling friction.
I agree with everything you stated. I will likely play with angular damping first. If need be, I'll try the "Valve method" of using a tri mesh collision shape. Luckily for me, there's only one surface that I care about -- the play area. Thus, tweaking angular damping shouldn't be too much of a chore.
Cheers.
Cheers.
-
- Posts: 16
- Joined: Tue Sep 09, 2008 8:56 am
Re: Rolling friction.
Hey can you guys help me out with this rolling friction problem? I'm trying to implement a ball rolling on a wavy organic triangle mesh. The triangles are about 6-7 units wide and the ball has a diameter of 1 unit and a weight of 1 unit.
I learned pretty quickly that merely setting friction on the surfaces doesn't stop the ball from rolling, so I implemented a custom contact callback that calls setDamping() on the ball when it comes in contact with the mesh (as was suggested in this thread)... While adjusting the linear and angular damping coefficients on the ball definitely has a visible impact, I still can't get the ball to stop as quickly as I would like.
Even calling setDamping(1.0f, 1.0f) doesn't stop the ball. I stepped through it in the debugger and applyDamping() is correctly zeroing out the ball's velocities (linear and angular), but for whatever reason it continues to move. It looks like the collision with the triangle mesh is continuing to impart momentum on the ball.
I noticed in the bullet code that applyDamping() is called before the collision detection phase... Is it really the collision that's continuing to impart momentum on the ball? How do I fix this?
Sorry to bring this thread up again, but I'm just not grokking what's happening here...
I learned pretty quickly that merely setting friction on the surfaces doesn't stop the ball from rolling, so I implemented a custom contact callback that calls setDamping() on the ball when it comes in contact with the mesh (as was suggested in this thread)... While adjusting the linear and angular damping coefficients on the ball definitely has a visible impact, I still can't get the ball to stop as quickly as I would like.
Even calling setDamping(1.0f, 1.0f) doesn't stop the ball. I stepped through it in the debugger and applyDamping() is correctly zeroing out the ball's velocities (linear and angular), but for whatever reason it continues to move. It looks like the collision with the triangle mesh is continuing to impart momentum on the ball.
I noticed in the bullet code that applyDamping() is called before the collision detection phase... Is it really the collision that's continuing to impart momentum on the ball? How do I fix this?
Sorry to bring this thread up again, but I'm just not grokking what's happening here...