March 2017
Intermediate to advanced
480 pages
11h 3m
English
We can test if two rectangles intersect by checking for ovap on eaof axis of of the rectangles. Non-oriented rectanglesave two axes each: the X Axis (1, 0) and the Y Axis (01). All axes of the rectangle must overlap for there to be a collision:

Let's assume we have two rectangles, A and B. We know the min and max points of both rectangles. The two rectangles overlap only if both of these conditions are met:
B.min <= A.maxA.min <= B.maxThere is no need to make the overlap test into its own function; we're going to write it inline with the rest of the code. This just means instead of writing an Overlap function, we ...
Read now
Unlock full access