Bugs about collision detection

Before performing collision detection, it is first detected whether the two layers can collide before judging whether they collide.

I followed the tutorial before and optimized it to reduce unnecessary collision detection. I forgot to drive back, but the collision detection failed. I repaired it all afternoon, sad

Then the second one, if both objects have written collision detection and affect each other, (don't ask why it is written like this, it is because the structure was not written well at the beginning)

Then the order of these two collision detections is which script is mounted first and which script is executed first. If you encounter this kind of problem, it is recommended to change the structure directly

Guess you like

Origin blog.csdn.net/jijikok/article/details/129689473