0

I'm coding a collision system for my 2D game engine in Java but I'm having problems with obtaining certain values. Lets say I have a rectangle and want to inscribe it into a grid. I want to list every grid cell which collide with the rectangle. As of rectangle what I know is its width, height, center point (x, y), angle in radians. As of cell, the coordinates of each cell are basically (n * size, m * size) where n, m = -2, -1, 0, 1, 2... (like in the image). I've been trying to find a fast solution for a long time but with no luck. I have also created a reference image for you to better understand my problem. The pink cells are the ones I want. I hope there's someone who had a similar problem and is willing to help me out :) Best of luck in your projects. Reference image

0 Answers0