not create Vec as possible for setting position
fix compiling error
Merge pull request #7900 from minggo/setposition-optimize

not create Vec as possible for setting position