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:
@@ -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();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -116,10 +116,8 @@ public:
|
|||||||
Use this yourself if you modify the children or their transforms. */
|
Use this yourself if you modify the children or their transforms. */
|
||||||
virtual void recalculateLocalAabb();
|
virtual void recalculateLocalAabb();
|
||||||
|
|
||||||
virtual void setLocalScaling(const btVector3& scaling)
|
virtual void setLocalScaling(const btVector3& scaling);
|
||||||
{
|
|
||||||
m_localScaling = scaling;
|
|
||||||
}
|
|
||||||
virtual const btVector3& getLocalScaling() const
|
virtual const btVector3& getLocalScaling() const
|
||||||
{
|
{
|
||||||
return m_localScaling;
|
return m_localScaling;
|
||||||
|
|||||||
Reference in New Issue
Block a user