My game is based on moving cubes within a level. I don’t want to use the built-in physics system but instead use some kind of rectangles-overlap method/function to determine collisions.
My question is, what would be the most efficient way to implement this using c#?
If you’re in 2D the Rect class already implements Overlap for you.
If you’re in 3D it’s an easy enough function to rewrite: you just check the axes and give up as soon as one min is greater than a max, or one max is less than a min.
I think all of this assumes that the rectangles cannot rotate though. If they can rotate it’s a different story. E.g. it’s really easy as long as your rects/boxes are axis-aligned.
i think once there’s rotation involved it gets a lot hairier.