AABB collision detection as a filter for SAT collision detection

I am currently attempting to implement basic collision detection and response in a 2D environment.

I have successfully implemented AABB collision detection, and SAT collision detection and response.

I was thinking about using the AABB check to see if SAT needs to be used in order to cut down on SAT calls.

Can anybody think of a reason why this will not work?

If so, please explain.

Thanks!

In theory you could add a flag to collidable objects that indicates whether you can perform AABB collision detection on them (probably don’t want to use a very basic primitive shape to represent the collision box for a curvy polygon for instance), and then perform a check to make sure that object meets the requirements of AABB (obviously aligned on both axis (no rotation relative to the origin of the world)). But you should benchmark your SAT calls to see if this is even worth it for a 2D game; so long as you don’t have thousands of collidable objects on the screen at one time I don’t think this will save you much.

This often a very good idea. As @Opiop says definitely benchmark and if there’s no need for it, don’t bother, but this is called the broadphase collision - with very broad, simple and indefinite collision tests and the narrow phase collision - with exacting collision tests which can be as complex as they need to be.