updateInertiaWorld method

void updateInertiaWorld([
  1. bool force = false
])

Update .inertiaWorld and .invInertiaWorld

Implementation

void updateInertiaWorld([bool force = false]) {
  final I = invInertia;
  if (I.x == I.y && I.y == I.z && !force) {
    // If inertia M = s*I, where I is identity and s a scalar, then
    //    R*M*R' = R*(s*I)*R' = s*R*I*R' = s*R*R' = s*I = M
    // where R is the rotation matrix.
    // In other words, we don't have to transform the inertia if all
    // inertia diagonal entries are equal.
  } else {
    final m1 = _uiwM1;
    final m2 = _uiwM2;
    m1.setRotationFromQuaternion(quaternion);
    m1.transpose(m2);
    m1.scale(I, m1);
    m1.mmult(m2, invInertiaWorld);
  }
}