3 ms·
This article made me realize that my NIH collision algorithm I implemented the other day[0] is a dead end. I wanted to put obejcts into bins so that pairs whic
by Tade0 8y ago
This article made me realize that my NIH collision algorithm I implemented the other day[0] is a dead end.
I wanted to put obejcts into bins so that pairs which are unlikely to collide are not checked.
Square bins are nice, but an object can potentially be in four of them at a time.
Hexagonal bins on the other hand reduce that number to three - great, but assignment is not as obvious.
If you look at the hex pattern the centers form a skewed grid - an appropriate affine transform should deal with that.
Does it help? Kinda. Coordinates in "hex space" are weird and now I see why - I'm using the wrong coordinate system to begin with.
[0] Making a game after-hours - the real project here is escaping from the immensely pragmatic world of writing software for money.