Fixed collision errors with obstacles due to time variable not resetting at certain points