SetLocalScaling propagates to btCompoundShape children now. Note that this issue might affect shared child shapes.

See also Issue 96
http://code.google.com/p/bullet/issues/detail?id=96

Thanks chucksspencer for the patch
This commit is contained in:
erwin.coumans
2009-12-18 01:13:33 +00:00
parent fcd2b93a22
commit 6bf3988837
2 changed files with 18 additions and 4 deletions

View File

@@ -264,3 +264,19 @@ void btCompoundShape::calculatePrincipalAxisTransform(btScalar* masses, btTransf
void btCompoundShape::setLocalScaling(const btVector3& scaling)
{
m_localScaling = scaling;
for(int i = 0; i < m_children.size(); i++)
{
btTransform childTrans = getChildTransform(i);
btVector3 childScale = m_children[i].m_childShape->getLocalScaling();
childScale = childScale * (childTrans.getBasis() * scaling);
m_children[i].m_childShape->setLocalScaling(childScale);
childTrans.setOrigin((childTrans.getOrigin())*scaling);
updateChildTransform(i, childTrans);
recalculateLocalAabb();
}
}