used atan2 to calculate velocity