Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a function to get a vector for a collision which corresponds to how much the rectangles collide in each axis (relative to rec1).
For example:
Given a Rectangle a = { 10, 10, 20, 20 }
and Rectangle b = { 20, 10, 20, 20 }.
The resulting output of this function would be { 10, 0 }.
Which means there is a collision of 10 units in the x axis.
If you flipped the order of the rectangles so rec1 = b and rec2 = a the resulting output would be { -10, 0 }.
This is handy for collisions in 2D games where you may want a character to be blocked from moving in one axis but not in another without doing two collision checks.