Open izvvv opened 5 months ago
If I place an obstacle at random, and I want to solve it in the same way as collision prevention in order to prevent the obstacle from colliding with other vehicles, I need to get the position of the other vehicle, what should I do?
I've found a solution, but there's a problem with it. When I run the running code, I get an error like this, but sometimes it works successfully and doesn't seem to be regular.
it's because you've found a collision at index i, so you remove obstacle x from the list, but you dont break out of the loop, so at index i+1 you may try to remove the obstacle x from the road objects again when it has been removed already.
I think just adding a break
statement after the a+=1 would be fine.
如果我随机放置障碍物,为了防止障碍物与其他车辆重合,我想要用预防碰撞一样方法来解决,则需要获取其他车辆的位置,请问我应该怎么做?