Search code examples
c++c2dcollision-detection

How to make a correct 2d mesh-to-circle collision detection


I'm trying to do a mesh-to-circle collision system for my game. I've seen some examples where you iterate over all the verts of the mesh and check if they are inside the circle. But the problem is that sometimes the vertices are not inside the circle, but the lines that this vertices form are. In this cases, the collision check evaluates to false when it should evaluate to true. How can I make a good collision detection of this type? (in c/c++)


Solution

  • Actually, a quick google lets you know that this is a duplicate of a question already on stack overflow: Circle line-segment collision detection algorithm?