reaching(): orientation control is implemented.
some global variables are added.