![Hands-On Game Development with WebAssembly](https://wfqqreader-1252317822.image.myqcloud.com/cover/571/36698571/b_36698571.jpg)
上QQ阅读APP看书,第一时间看更新
Circle collision detection
The most basic kind of collision detection is circle or distance collision detection. If we treat all of our colliders like little circles with a radius and a position, we can calculate the distance between the two locations and see whether that distance is less than the sum of our radii. This form of collision detection is high-speed, but precision is limited. If you look at the projectile in our game, this method works pretty well. Our spaceships, on the other hand, don't fit neatly into a circle. We can adjust the radius of our circle collider on any given ship to give slightly different results. When circle collision detection works, it can be very efficient:
![](https://epubservercos.yuewen.com/1EACDC/19470378408806806/epubprivate/OEBPS/Images/7d6fab86-e4bd-4a7c-9d6c-f8dcd049fe88.png?sign=1738807591-H7o9hplbXsp5xrqIYuSqrQCFCda7SvEk-0-ba64403a2ef4f3f0b562d63f42ea70f6)
Circle collision hit test