Check if a point is inside the screen

Hi,
I am trying to check if a point is inside the screen, but I can’t get it to work. I am constructing a rect that should represent the normalised screen area and I am trying to detect if the mouse position is inside this rect. My screen resolution is 1920 by 1200. Let me know if I am doing something terribly wrong.

Rect bbox;
Vector2 bbox_min = Vector2(0.0,0.0);
Vector2 bbox_max = Vector2(0.9,0.9);
bbox = Rect(bbox_min, bbox_max);

Camera* camera = scene_->GetChild("Camera")->GetComponent<Camera>();
Vector3 result = camera->WorldToScreenPoint(mousePosition);

if(bbox.IsInside(Vector2(result.x_, result.y_))==INSIDE)
	cout << "Inside" << endl;

mouse already in screen coords

Sorry I didn’t explain it properly. First I am transforming mousePosition to world space as I am driving some objects around. Then I am transforming back to screen space.

Vector3 pos = camera->ScreenToWorldPoint(Vector3(mousePosition_.x_ / graphics->GetWidth(), mousePosition_.y_ / graphics->GetHeight(), 10.0f));
//Later 
Camera* camera = scene_->GetChild("Camera")->GetComponent<Camera>();
Vector3 result = camera->WorldToScreenPoint(pos);

From the above code it is not clear what you want to do

Vector3 pos = camera->ScreenToWorldPoint(Vector3(mousePosition_.x_ / graphics->GetWidth(), mousePosition_.y_ / graphics->GetHeight(), 10.0f));

Why do you use a value of 10?

This is in the particle example.

Yes, it works for orto camera only. Your app is 2D?

Yes it is in 2d with Ortho camera.

Solved my min bounds were wrong.