# Physics Simulation Forum

 All times are UTC

 Page 1 of 1 [ 8 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: Odd behaviors with Friction and RestitutionPosted: Wed Aug 31, 2011 11:03 pm

Joined: Sun Jan 17, 2010 4:47 am
Posts: 153
I'm having two completely separate minor problems, one with friction, and one with restitution, that I could work around, but I'd rather understand bullet more deeply and get my simulation setup just right, so I hope some other people out there that have used friction and restitution can enlighten me.

My issue with friction:
I have a box rigid body on top of a sloped bvhTriangleMeshShape, which increases it's slope in increments(20 units of the slope is ~6 degree grade, next 20 units is ~14 degree, etc.). The friction on the box is set to 0.8, and the friction on the terrain is 1.0. When I throw the box to the top of the slope, I'd expect it to come to a rest at the top of the slope, but instead it jitters, a lot. It also gradually shakes it's way down the slope, sometimes coming to a rest briefly before jittering again. My goal is to eliminate sliding without having to set a preposterous friction setting, and to eliminate the jitter. Are there any other parameters I can set to help how friction is handled in my simulation?

My issue with restitution:
In another simulation I have a ball that I through at another bvhTriangleMeshShape downward and to the right(camera perspective). I have restitution value set to 0.8 on the ball(imagining a rubber ball) and the terrain's restitution value set to 1.0(imagining something excessively bouncy). When the ball is thrown at the terrain at a ~45 degree angle down and to the right I expect it to bounce back up to ~90+/-5% of the height it started but to keep moving to the right. Instead, more often then not, it will bounce back in the direction it came from. Rarely depending on the rotation of the ball(since I'm throwing with click and drag using a P2P constraint) it will do as I expect, but of the ~40 test throws I've done so far I've accomplished this only once. I do understand the direction after impact can be influenced by rotation, a basketball is a good example when you spin it as you throw it to the ground. But this seems excessive. Like my question with friction, are there any other parameters I can set anywhere to help control how restitution behaves in Bullet? Ideally to tone back this behavior?

Top

 Post subject: Re: Odd behaviors with Friction and RestitutionPosted: Fri Sep 02, 2011 4:06 pm

Joined: Sun Jan 17, 2010 4:47 am
Posts: 153
A little bit more information about my restitution issue, I forget to mention that I am using a btSphereShape for my ball, and I have it's friction set to 0.1. The spin on the ball should be a factor, but not enough for it to bounce back in the exact direction it came from. I've also started using different search terms when looking for more information on this issue, and found a few posts with similar/identical issues as mine:

viewtopic.php?f=9&t=7248
viewtopic.php?f=4&t=6202
viewtopic.php?f=9&t=3811

After reading that last one, I too tried to enable split impulse and it didn't make any difference at all. I'm still getting quite unrealistic bounces.

Top

 Post subject: Re: Odd behaviors with Friction and RestitutionPosted: Sat Sep 03, 2011 11:00 pm

Joined: Sun Jan 17, 2010 4:47 am
Posts: 153
Another small update. I tried enabling CCD, figuring the normals for the collision may be more accurate that way. I followed all the code that was used in the CCD demo and not only did it not change anything, but it seems my objects still tend to tunnel through the terrain if I throw fast enough. So maybe that isn't conclusive as CCD may not be working.

Things I copied from the Demo:
Set iterations on the solver to 20.
Enabled split impulse on the solver.
Enabled continuous on the dispatcher.
Set the motion threshold and swept sphere radius on the body appropriately.

I may need to start splitting this into multiple threads... =\

Top

 Post subject: Re: Odd behaviors with Friction and RestitutionPosted: Thu Sep 08, 2011 3:04 am

Joined: Thu Sep 08, 2011 1:59 am
Posts: 23
Hi,
saw your post and i too am having a similar problem. I get my ball sticking on walls and not rebounding as it should.
I also want to introduce softbodies into my game but just by including "#include "btSoftBody.h" i get errors such as
"error: expected identifier before numeric constant ..line 94". I'm using codeblocks under linux 32-bit as my platform.

Any help would be greatly appreciated

here is my game so far http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=17&t=7416

Top

 Post subject: Re: Odd behaviors with Friction and RestitutionPosted: Thu Sep 08, 2011 10:05 pm

Joined: Sun Jan 17, 2010 4:47 am
Posts: 153
I managed to resolve the balls getting stuck to the wall by reducing the swept sphere radius I was setting for my objects when enabling CCD. I don't know if you are enabling CCD or not, if not then my fix isn't applicable to you. If you are using CCD, then you probably just need to do as I did. I originally assumed I just needed an sphere that would barely fully embed inside my collision shape, but it turns out you need to take that radius and then multiply it by 0.2. Then you'll get working CCD.

Not sure if you are having any of the other same issues I was having, but I also managed to solve my restitution issue by switching from a bvhTriangleMeshShape to a compound shape of box's. Seems bvhTriangleMeshShapes don't interact well with restitution. My friction issue however, still remains.

Top

 Post subject: Re: Odd behaviors with Friction and RestitutionPosted: Fri Sep 09, 2011 8:24 pm

Joined: Fri May 30, 2008 2:51 am
Posts: 508
Location: Ossining, New York
I found CCD sphere sweeping to be very unreliable when I tried it a few years ago and no-longer use it

Top

 Post subject: Re: Odd behaviors with Friction and RestitutionPosted: Fri Sep 09, 2011 9:24 pm

Joined: Sun Jan 17, 2010 4:47 am
Posts: 153
I'm noticing the same thing in my simulations. Occasionally objects will tunnel despite it, even at lower speeds where you wouldn't expect it. But overall I'm getting a little less tunneling and since my simulations are based on mouse thrown objects, it's pretty easy to get fast moving objects if the user felt like it. So I need to minimize tunneling as much as I can.

Top

 Post subject: Re: Odd behaviors with Friction and RestitutionPosted: Sat Sep 10, 2011 3:49 pm

Joined: Sun Jun 26, 2005 6:43 pm
Posts: 3825
Location: California, USA
Quote:
but it seems my objects still tend to tunnel through the terrain if I throw fast enough. So maybe that isn't conclusive as CCD may not be working.

and
sparkprime wrote:
I found CCD sphere sweeping to be very unreliable when I tried it a few years ago and no-longer use it

Try using CCD, and if it is not reliable, help creating a reproduction case in a Bullet demo, so someone can fix it. We need to create more unit tests.
Thanks,
Erwin

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 8 posts ]

 All times are UTC

#### Who is online

Users browsing this forum: Bing [Bot] and 4 guests

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ BULLET PHYSICS LIBRARY USERS    General Bullet Physics Support and Feedback    Release Announcements    Applications, Games, Demos or Movies using Bullet PHYSICS AUTHORING TOOLS, SERIALIZATION AND STANDARDS    Physics authoring tools, serialization, standards and related topics RESEARCH AND DEVELOPMENT IN COLLISION DETECTION & PHYSICS. Don't post Bullet support questions here!    Research and development discussion about Collision Detection and Physics Simulation    Links, Papers, Libraries, Demos, Movies, Comparisons       Non-technical forum and license/patent discussion    Career Opportunities