BulletSim: add BSConstraint.RecomputConstraintVariables for the recomputation after linksets changed, etc

integration
Robert Adams 2012-08-14 16:24:34 -07:00
parent 6f1f299619
commit c1c1d48af1
1 changed files with 17 additions and 0 deletions

View File

@ -80,10 +80,27 @@ public abstract class BSConstraint : IDisposable
bool ret = false; bool ret = false;
if (m_enabled) if (m_enabled)
{ {
// Recompute the internal transforms
BulletSimAPI.CalculateTransforms2(m_constraint.Ptr); BulletSimAPI.CalculateTransforms2(m_constraint.Ptr);
ret = true; ret = true;
} }
return ret; return ret;
} }
// Reset this constraint making sure it has all its internal structures
// recomputed and is enabled and ready to go.
public virtual bool RecomputeConstraintVariables(float mass)
{
bool ret = false;
if (m_enabled)
{
ret = CalculateTransforms();
if (ret)
{
BulletSimAPI.SetConstraintEnable2(m_constraint.Ptr, m_world.scene.NumericBool(true));
}
}
return ret;
}
} }
} }