I would guess that it's based on Ophelia's position, which can be manipulated by entering the cutscene in different ways. Having party members fall into designated positions in cutscenes would likely prevent this sort of thing in future.