public void update()
{
if( _break )
{
decompose();
isBroken = true;
_break = false;
}
// Cache velocities to improve movement on breakage.
if( isBroken == false )
{
//Enlarge the cache if needed
if( parts.Count > _angularVelocitiesCache.Length )
{
_velocitiesCache = new Vector2[parts.Count];
_angularVelocitiesCache = new float[parts.Count];
}
//Cache the linear and angular velocities.
for( int i = 0; i < parts.Count; i++ )
{
_velocitiesCache[i] = parts[i].body.linearVelocity;
_angularVelocitiesCache[i] = parts[i].body.angularVelocity;
}
}
}