def compensateModuleRotation(pos, rot): m = getPivotedRotation(self.pos, self.rot) # update position and rotation according to module's rotation pos = m * pos rot = m.getMat3() * rot return (pos, rot)