guys! I have a problems with processing collision of game objects (with other sizes). My algorithm is:
for (Array<GameObject*>::iterator it = objects.begin(); it != objects.end(); it++)
{
RECT objRect = (*it)->GetBoundingBox();
for (Array<GameObject*>::iterator it2 = object.begin(); it2 != object.end(); it2++)
{
RECT objRect2 = (*it2)->GetBoundingBox();
IntersectRectangles(objRect, objRect2);
}
}
Yes, that is works fine. But it works very slow. I have a idea (check only nearby objects to object), but that means more and more iterations. Maybe the better way is exist?