real time version with collision check