improved the collision detection efficiency