Major contact stability improvement

User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Major contact stability improvement

Post by Erwin Coumans »

majestik666 wrote:Thanks for implementing that !
I'll update our code base and see how it behaves.

Is it something that will stay in there or is it just
some kind of experiment ?
The results with rolling friction are good so it is going to stay in Bullet.
I just improved rolling friction with anisotropic directions so that capsules, cylinders and cones don't rest in unrealistic poses. Check out the updated version in Bullet trunk, in particular the updated Bullet/Demos/RollingFrictionDemo.

All the parts of Laurent's patch that influence jitter are integrated into the latest Bullet trunk: parts related to restitution, and part related to friction.
The other part of Laurent's patch is related to the order of integration, which doesn't influence jitter, but it impacts CCD negatively so I didn't integrate that part.
User avatar
majestik666
Posts: 66
Joined: Tue Mar 02, 2010 6:13 am

Re: Major contact stability improvement

Post by majestik666 »

Just finished updating the bullet tree in our plugin,
and implementing the rolling friction now, it is
missing from the rigidBodyConstructionInfo though ?
Any chance to get that in there ?

Code: Select all

        struct  btRigidBodyConstructionInfo
        {
                ...
                ///best simulation results when friction is non-zero
                btScalar                        m_friction;
                btScalar                        m_rollingFriction; // Missing this
                ///best simulation results using zero restitution.
                btScalar                        m_restitution;
                ...
        }
And in the constructor of course to use the constructionInfo.

Thanks !
F
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Major contact stability improvement

Post by Erwin Coumans »

Thanks for the feedback, I'll add the member to btRigidBodyConstructionInfo.

Make sure also enable the anisotropic rolling friction direction for each shape that has rolling friction enabled:

Code: Select all

	body->setRollingFriction(.3);
	body->setAnisotropicFriction(colShape->getAnisotropicRollingFrictionDirection(),btCollisionObject::CF_ANISOTROPIC_ROLLING_FRICTION);
The rolling friction is most useful for btSphereShape, btCapsuleShape*, btCylinderShape* and btConeShape*. If you have more complex friction direction (such as a btCompoundShape with various implicit shapes, you can use a contact callback to manually override the an-isotropic friction direction.

Please let me know your experience with the rolling friction.
User avatar
majestik666
Posts: 66
Joined: Tue Mar 02, 2010 6:13 am

Re: Major contact stability improvement

Post by majestik666 »

I played a bit with it , using convex hulls , and seems to work pretty well,
the only noticable thing about it, is the same as the linear friction, the
behaviour doesn't seem to give linear feedback based on the value.
Low values will have very little effect but when reaching higher values the
effect of the friction increases a lot.

I assume the maths are correct internally but it makes it a bit tricky
to adjust the values.

Thanks for implementing all this !
Francois
User avatar
majestik666
Posts: 66
Joined: Tue Mar 02, 2010 6:13 am

Re: Major contact stability improvement

Post by majestik666 »

I'm actually getting some regression it looks like regarding friction ..

The older version of Bullet we were running (2.76) seemed to work great
but using the latest trunk, it looks like we're not getting any more friction
at all coming from kinematic bodies.

I don't actually have a basic scene to reproduce as we work exclusively in maya,
but basically I have a maya scene with a cube used as a ground plane moving back
and forth on the X axis, and a cube resting on top of it (both using the Box collision shape).
The top cube reacts as if the bottom cube was not moving at all, we do not get
any inherited velocity from the contact itself.

I will try and look deeper see if i can spot any changes that would create that problem ...

EDIT: Managed to reproduce with a very simple BasicDemo app, and tested against bullet 2.76 and
it was working fine then, not anymore ...
Submitted a new issue with the BasicDemo.cpp file

Cheers
Francois
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Major contact stability improvement

Post by Erwin Coumans »

Thanks Francois, it is fixed in latest trunk. Can you double-check?
Low values will have very little effect but when reaching higher values the
effect of the friction increases a lot.
Right now the rolling friction magnitude scales linearly with the normal collision impulse, but it should be clamped. I'll add it before the next release, hopefully very soon.
Thanks!
Erwin
User avatar
majestik666
Posts: 66
Joined: Tue Mar 02, 2010 6:13 am

Re: Major contact stability improvement

Post by majestik666 »

yep, just tested and it's all good now !

Thanks a lot for the super speedy fix !!
Francois
User avatar
majestik666
Posts: 66
Joined: Tue Mar 02, 2010 6:13 am

Re: Major contact stability improvement

Post by majestik666 »

I might have spoken too soon ...

something else came up with the very latest trunk .. didn't happen before,
I couldn't reproduce it in the BasicDemo scene though :/

Basically a stack of boxes being hit by a kinematic sphere, and falling down
on another box. With the latest trunk some of the boxes go through the
ground while the rest stays nicely above it.

Any idea what could that be ?
Attachments
After ~100 frames, some cubes<br />went through the ground cube.
After ~100 frames, some cubes
went through the ground cube.
cubes1.jpeg (41.58 KiB) Viewed 17947 times
Start frame
Start frame
cubes.jpeg (64.03 KiB) Viewed 17947 times
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Major contact stability improvement

Post by Erwin Coumans »

Thanks again for testing and reporting the issue. I was a big too fast with the fix and forgot to reset some value.

It should be fixed now, can you double-check latest trunk?
mdias
Posts: 12
Joined: Thu Jun 28, 2012 2:21 pm

Re: Major contact stability improvement

Post by mdias »

I think "cp.m_lateralFrictionInitialized = false;" on line 835, file btSequetialImpulseConstraintSolver.cpp is not supposed to be there?
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Major contact stability improvement

Post by Erwin Coumans »

Indeed. There are some issues in latest trunk, I will sort it out asap.

Thanks for the report!
Erwin
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA
Contact:

Re: Major contact stability improvement

Post by Erwin Coumans »

I fixed it, can you check it out?

Thanks!
Erwin
mdias
Posts: 12
Joined: Thu Jun 28, 2012 2:21 pm

Re: Major contact stability improvement

Post by mdias »

It's fixed.

I cannot build the extras though:
"BulletXmlWorldImporter/btBulletXmlWorldImporter.cpp:589:16: error: ‘intptr_t’ was not declared in this scope"
Post Reply