3 ms·
This looks great! precisely what I needed. If I want collision-detection in 2D, are there other alternative algorithms? Is this the most efficient method? (for
by MasterScrat 11y ago
This looks great! precisely what I needed.
If I want collision-detection in 2D, are there other alternative algorithms? Is this the most efficient method? (for objects with finite sizes)
- MJSplot_author 11y agoI wrote this for a small game I'm updating, which has about 30 objects colliding. However in my situation because it has so few objects the overhead is greater than the time saved. This system works really well when there are many objects. See if you can use a regular quadTree if you can find a way to do it. It'll be faster than this. I don't know about the _most_ efficient method. That is a field of research bigger than my weekend project. Good luck.
- MasterScrat 11y agoI'm also working on a 2D game. I end up with hundreds of objects so maybe this solution will make more sense in my case. I have to run benchmarks... I like the approach of finite-size objects since I'm mostly working with creatures that collide or not based on their radius. I also have some polygons, but I can easily simplify them into circles (https://en.wikipedia.org/wiki/Smallest-circle_problem https://en.wikipedia.org/wiki/Smallest-circle_problem).