I'm creating a 2D game in Unity that relies on combining colors. For instance, if the yellow sprite in in a position, and the player slides a magenta sprite partly over it, the area where the two intersect should become red. If someone then slides a cyan sprite, the cyan+yellow should be green, the cyan+magenta should be blue, and the cyan+red should be black.
I was planning to use box collider 2d and use a OverlapArea on TriggerStay2D, but that didn't work. I'm assuming in my code below that pointA is the upper left coordinate of the first sprite, and pointB is the upper left coordinate of the second sprite (though perhaps I'm wrong on that).
void OnTriggerStay2D(Collider2D collisionInfo)
Debug.Log("I am still colliding");
pointA = this.transform.position;
pointB = collisionInfo.transform.position;
Vector2 pointC = Physics2D.OverlapArea(pointA, pointB);
After reading the documentation, I think I'm not understanding what OverlapArea returns - it seems to return a Collision, but that doesn't make a whole lot of sense.
Any thoughts on this? Is there a better way than trying to find a pair of 2-Tuples that would bound the collision area and create a new sprite of the new color over that area?