Origin of the cubic-to-hexagonal phase transition in the Ba2NiWO6-BaTiO3 system