Page 4 of 4

Re: Major contact stability improvement

Posted: Sun Sep 16, 2012 5:12 pm
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.

Re: Major contact stability improvement

Posted: Mon Sep 17, 2012 6:47 am
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

Re: Major contact stability improvement

Posted: Mon Sep 17, 2012 4:11 pm
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.

Re: Major contact stability improvement

Posted: Mon Sep 17, 2012 9:04 pm
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

Re: Major contact stability improvement

Posted: Thu Sep 20, 2012 2:17 am
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

Re: Major contact stability improvement

Posted: Thu Sep 20, 2012 3:39 am
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

Re: Major contact stability improvement

Posted: Thu Sep 20, 2012 3:59 am
by majestik666
yep, just tested and it's all good now !

Thanks a lot for the super speedy fix !!
Francois

Re: Major contact stability improvement

Posted: Thu Sep 20, 2012 4:26 am
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 ?

Re: Major contact stability improvement

Posted: Thu Sep 20, 2012 11:34 am
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?

Re: Major contact stability improvement

Posted: Fri Sep 28, 2012 5:08 pm
by mdias
I think "cp.m_lateralFrictionInitialized = false;" on line 835, file btSequetialImpulseConstraintSolver.cpp is not supposed to be there?

Re: Major contact stability improvement

Posted: Sat Sep 29, 2012 12:17 am
by Erwin Coumans
Indeed. There are some issues in latest trunk, I will sort it out asap.

Thanks for the report!
Erwin

Re: Major contact stability improvement

Posted: Sat Sep 29, 2012 1:53 am
by Erwin Coumans
I fixed it, can you check it out?

Thanks!
Erwin

Re: Major contact stability improvement

Posted: Sat Sep 29, 2012 2:55 am
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"