Pixel perfect collision with rotation?

I usually use this method for pixel perfect collision:

    public bool IntersectPixels(Rectangle rectangleA, Color[] dataA, Rectangle rectangleB, Color[] dataB)
        // Find the bounds of the rectangle intersection
        int top = Math.Max(rectangleA.Top, rectangleB.Top);
        int bottom = Math.Min(rectangleA.Bottom, rectangleB.Bottom);
        int left = Math.Max(rectangleA.Left, rectangleB.Left);
        int right = Math.Min(rectangleA.Right, rectangleB.Right);

        // Check every point within the intersection bounds
        for (int y = top; y < bottom; y++)
            for (int x = left; x < right; x++)
                // Get the color of both pixels at this point
                Color colorA = dataA[(x - rectangleA.Left) +
                                     (y - rectangleA.Top) * rectangleA.Width];
                Color colorB = dataB[(x - rectangleB.Left) +
                                     (y - rectangleB.Top) * rectangleB.Width];

                // If both pixels are not completely transparent,
                if (colorA.A != 0 && colorB.A != 0)
                    // then an intersection has been found
                    return true;

        // No intersection found
        return false;

But if I rotate the object it will still just check it as it had no collision (because that is how the method works, obviously). So I was wondering if I could like include float rotationA and float rotationB and it will do pixel perfect collision with that rotation!

Hope it made sense!

try this:

add add

1 Like

Oh, thank you very much <3

Aint there a 1 frame late with occ. Queries? I read in nvidia papers the app must give some time to the gpu to process the query

yah… in c29… but it fast and simple
so deciseto use OQ or calculate perpixel in two given links