Dev Log: Collisions!
I'm back working on my C# and SFML framework after many weeks of very very slow progress. I've been tackling all the different kinds of collision detection that I want to have, and although the rectangle to rectangle collisions are easy, stuff like rectangle to grid started to get a little messy.
So then I got to the point where I wanted to add line segments and circles into the mix, and even with just these four types I found myself in a maze of code and math.
After trying to figure out some math on my own, I finally stumbled upon some line segment intersection code that helped out quite a bit. After I got that running, I was also able to find a line segment to circle collision example, and that gave me enough to fill in the rest of the blanks.
So now I have four collider types: Rectangles, Grids, Circles, and Lines, and they are all able to collide with each other. I haven't super thoroughly tested this stuff out yet though, so I'm sure some of it must be broken somewhere, but for the rest of the week I'll be testing this stuff out a little more.
So then I got to the point where I wanted to add line segments and circles into the mix, and even with just these four types I found myself in a maze of code and math.
After trying to figure out some math on my own, I finally stumbled upon some line segment intersection code that helped out quite a bit. After I got that running, I was also able to find a line segment to circle collision example, and that gave me enough to fill in the rest of the blanks.
So now I have four collider types: Rectangles, Grids, Circles, and Lines, and they are all able to collide with each other. I haven't super thoroughly tested this stuff out yet though, so I'm sure some of it must be broken somewhere, but for the rest of the week I'll be testing this stuff out a little more.
No Comments