fix calculating rotation
Merge pull request #3631 from 2youyouo2/master

fix calculating rotation
Merge branch 'master' into #4557