Page 1 of 1

Compound Shape's children with different Friction ?

Posted: Tue Dec 16, 2014 11:04 am
by papaonn
It seems like Bullet does not support Compound Shape with different friction children.

How do i achieve this ?

Re: Compound Shape's children with different Friction ?

Posted: Tue Dec 16, 2014 12:00 pm
by Flix
Using a custom material callback you can override friction on a compound child basis.

I don't remember the details ATM, but AFAIR the introduction of the btCollisionObjectWrapper class into Bullet was done to extend this possibility to handle nested compound children too.

However I'd stick to the partId and/or index arguments of the callback and make some experiments.

[Edit:]
In the callback, try something like this:

Code: Select all

const btCollisionObject* colObj0 = colObj0Wrapper->getCollisionObject();
    const btCollisionObject* colObj1 = colObj1Wrapper->getCollisionObject();
    const btCollisionShape* colShape0 = colObj0->getCollisionShape();
    const btCollisionShape* colShape1 = colObj1->getCollisionShape();
    if (colShape0==myCompound) {
        if (index0<someNumber) {
            cp.m_combinedFriction = cp.m_combinedRestitution = 0;
             return true;
        }
        else {
            cp.m_combinedFriction = cp.m_combinedRestitution = 10;
            return true;
        }
    }
    // Do the same for colShape1 and index1