- Home /
Rect contains question (regarding negative x,y values)
Hello. I know this is easy, and I should probably know this, but I have a rect defined that is centered at 0,0. So the extents of the rect are -512, 384, 512, -384.
I want to take a mouse position and determine if the position is contained with the rect. What is the best way to do this?
I could shift the values up so that the min x and y are positive, then do a Rect.contains() with the shifted mouse position. Or is there some easy matrix math that can accomplish this?
Thanks.
Your answer
Follow this Question
Related Questions
rect.Contains problem? 2 Answers
Getting Rect from scrollview according to position in scrollview 2 Answers
Problem with uvRect.Compare(mouse position in Vector2) 0 Answers
Possible to return the names of gameobjects inside a rect? 1 Answer
Need help understanding GUI and Rect.Contains interaction 0 Answers