WorldToScreenPoint and ScreenToWorld point...Help...

Hi Guys,

I am doing an having use of WorldToScreenPoint and ScreenToWorldPoint… now,

when I click on my IPad Screen those coordinates are in ScreenCoordinate ok? I would like to see the ray shot in 3D from that point screen. So I used ScreenToWorldPoint but for whatever reason I see the Ray but not leaving from my screen point but quite shifted away. I wonder, Are those 2 functions considering the trasformation to the viewport space?

Screen-> Viewport->3D World like this or not?

Instead, when I project a world point onto the screen, it doesn’t have the expected position… again the point on the screen is different from the real projection… so I wonder if I have to transform everything in Viewport coodinates system.

Many thanks.!
GC

ScreenPointToRay takes the x,y point from the camera position to the near clip plane corresponding to the x and y values. The ray extends from the near clip plane away from the camera. If you were to debug that line, it should only be a dot, since the whole ray should be centered on the viewport pixel.

Now, this all works fine, if the viewport and screen match. If not, you will need to use the ViewportPointToRay to get that specific viewport. It will follow the same guidelines as ScreenPointToRay