add code about collision detect