Returns inversion of a matrix which contains only rotations and translations
Code:
type
  TMatrix4s = packed record
    _11, _12, _13, _14: Single;
    _21, _22, _23, _24: Single;
    _31, _32, _33, _34: Single;
    _41, _42, _43, _44: Single;
  end;

function InvertRotTransMatrix(const M: TMatrix4s): TMatrix4s; 
begin
  // Inverse rotation
  Result._11 := M._11;
  Result._12 := M._21;
  Result._13 := M._31;
  Result._21 := M._12;
  Result._22 := M._22;
  Result._23 := M._32;
  Result._31 := M._13;
  Result._32 := M._23;
  Result._33 := M._33;
// Inverse translation
  Result._41 := -M._41 * M._11 - M._42 * M._12 - M._43 * M._13;
  Result._42 := -M._41 * M._21 - M._42 * M._22 - M._43 * M._23;
  Result._43 := -M._41 * M._31 - M._42 * M._32 - M._43 * M._33;
// Fill other values
  Result._14 := M._14;
  Result._24 := M._24;
  Result._34 := M._34;
  Result._44 := M._44;
end;