Performance optimization for btCompoundShape::setLocalScaling
Thanks to Mirza, See Issue 487 backward compatibility fix for recent improvement in btRaycastVehicle 'rollinfluence' Thanks to Mihail, See Issue 468
This commit is contained in:
@@ -85,7 +85,7 @@ void btCompoundShape::addChildShape(const btTransform& localTransform,btCollisio
|
||||
|
||||
}
|
||||
|
||||
void btCompoundShape::updateChildTransform(int childIndex, const btTransform& newChildTransform)
|
||||
void btCompoundShape::updateChildTransform(int childIndex, const btTransform& newChildTransform,bool shouldRecalculateLocalAabb)
|
||||
{
|
||||
m_children[childIndex].m_transform = newChildTransform;
|
||||
|
||||
@@ -99,7 +99,10 @@ void btCompoundShape::updateChildTransform(int childIndex, const btTransform& ne
|
||||
m_dynamicAabbTree->update(m_children[childIndex].m_node,bounds);
|
||||
}
|
||||
|
||||
recalculateLocalAabb();
|
||||
if (shouldRecalculateLocalAabb)
|
||||
{
|
||||
recalculateLocalAabb();
|
||||
}
|
||||
}
|
||||
|
||||
void btCompoundShape::removeChildShapeByIndex(int childShapeIndex)
|
||||
@@ -283,10 +286,12 @@ void btCompoundShape::setLocalScaling(const btVector3& scaling)
|
||||
childScale = childScale * scaling / m_localScaling;
|
||||
m_children[i].m_childShape->setLocalScaling(childScale);
|
||||
childTrans.setOrigin((childTrans.getOrigin())*scaling);
|
||||
updateChildTransform(i, childTrans);
|
||||
recalculateLocalAabb();
|
||||
updateChildTransform(i, childTrans,false);
|
||||
}
|
||||
|
||||
m_localScaling = scaling;
|
||||
recalculateLocalAabb();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user