Creating a matrix or some sort.

Sorry if the title doesnt match. I couldnt really think of what to write for the title.

I'm working on creating a bounding box or a matrix using array to detect the position of the user's finger. My idea of it is setting a bounding box made with array and detect whether the finger is within the range of the bounding box. Is there any way to go about it?


I figured out that was such a method called Rect.Contains. This did what I wanted.

var rect = Rect(x,y,width,height);


The var rect creates a box and the if statement checks that if the touch is within the box.

However, I have a problem of putting it in ArrayList. It gives me the following error: The type 'System.Collections.ArrayList' does not have a visible constructor. I don't face this problem when I put in Array though.

Would be great if someone can explain why this error may have occured.

What would be best is to simply see if the finger is between two Vector2s like this

if ((touch.position - topLeftPos).SqrMagnitude() > 0 && (touch.position - lowerRightPos).SqrMagnitude() < 0) {
    //do stuff with touch