added a gravity setting.
bug fixed to calculate orginpos.