BulletSim: only compute linkset mass when membership changes rather than everytime someone asks for it.
parent
36d77fe27c
commit
702fd1e094
|
@ -49,6 +49,9 @@ public abstract class BSLinkset
|
||||||
|
|
||||||
switch ((int)physScene.Params.linksetImplementation)
|
switch ((int)physScene.Params.linksetImplementation)
|
||||||
{
|
{
|
||||||
|
case (int)LinksetImplementation.Constraint:
|
||||||
|
ret = new BSLinksetConstraints(physScene, parent);
|
||||||
|
break;
|
||||||
case (int)LinksetImplementation.Compound:
|
case (int)LinksetImplementation.Compound:
|
||||||
ret = new BSLinksetCompound(physScene, parent);
|
ret = new BSLinksetCompound(physScene, parent);
|
||||||
break;
|
break;
|
||||||
|
@ -56,7 +59,7 @@ public abstract class BSLinkset
|
||||||
// ret = new BSLinksetManual(physScene, parent);
|
// ret = new BSLinksetManual(physScene, parent);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
ret = new BSLinksetConstraints(physScene, parent);
|
ret = new BSLinksetCompound(physScene, parent);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -97,7 +100,6 @@ public abstract class BSLinkset
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
m_mass = ComputeLinksetMass();
|
|
||||||
return m_mass;
|
return m_mass;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -138,6 +140,7 @@ public abstract class BSLinkset
|
||||||
// Don't add the root to its own linkset
|
// Don't add the root to its own linkset
|
||||||
if (!IsRoot(child))
|
if (!IsRoot(child))
|
||||||
AddChildToLinkset(child);
|
AddChildToLinkset(child);
|
||||||
|
m_mass = ComputeLinksetMass();
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -156,6 +159,7 @@ public abstract class BSLinkset
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
RemoveChildFromLinkset(child);
|
RemoveChildFromLinkset(child);
|
||||||
|
m_mass = ComputeLinksetMass();
|
||||||
}
|
}
|
||||||
|
|
||||||
// The child is down to a linkset of just itself
|
// The child is down to a linkset of just itself
|
||||||
|
|
Loading…
Reference in New Issue