It seems like Bullet does not support Compound Shape with different friction children.
How do i achieve this ?
Compound Shape's children with different Friction ?
-
- Posts: 41
- Joined: Wed Nov 20, 2013 4:14 pm
-
- Posts: 456
- Joined: Tue Dec 25, 2007 1:06 pm
Re: Compound Shape's children with different Friction ?
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:
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