Help understanding GetPixels() Paramenters
I'm trying to make my own version to understand more about pixel perfect collsions on unity (not using polygons2D) using some of this scripts below as reference from :
https://timeshapers.com/2014/05/09/pixel-perfect-collision-in-unity-2d/
https://github.com/poeticmatter/tutorials/tree/master/Collision
But there is a part that's I don't understand even after reading a lot of time the script reference at: https://docs.unity3d.com/ScriptReference/Texture2D.GetPixels.html
is too much to ask here to someone draw a image explaining how this works about the x, y, blockWidth and blockHeight parameters and what kind of values it takes like is global, local,world,view or screen? Because i can't find any questions about this on unity.
I already maded a lot of tests trying to figure it out how this work but another problem comes up and one of this is this exception that's appear saying something about this int32.
from this code:
private static Color[] getBitArray(Bounds2D section, Texture2D texture)
{
return texture.GetPixels(section.x, section.y, section.width, section.height);
}
there is something about the pixels per unit of the image?Or Because i'm using a spritesheet while the animation is playing changing the sprite for both of the gameobjects while the detection is occurring?
Another test that i made it was to create a Rect on the collision between two sprites and just take using GetPixels() the location(intersection) of both of sprites the pixels inside this rect to check the perfect pixel collision but there was an "inconsistency" with the parameters because i'dont know what kind of value should i convert to put on GetPixels().