Fix transformation order bug in movement direction calculation.