changed velocity calculations to use sin cos