Home > other >  Help: for the world series of rays to point coordinates of the screen, the screen point)
Help: for the world series of rays to point coordinates of the screen, the screen point)

Time:09-26

Such as topic, typically from the screen to the world series of rays hit, now you need to, in turn, from the world of the ray hit the point on the screen (hope is screen coordinates), consider for a long time, haven't solved,

CodePudding user response:

//1. The screen on the coordinates,
Vector3 Camera. Main. ScreenToWorldPoint (new Vector3 (screenPos. X, screenPos. J y, zInfo));
//2. Turn the screen coordinates
Vector3 Camera. Main. WorldToScreenPoint (new Vector3 (worldPos. X, worldPos. J y, worldPos. Z));
//3. Turn the viewport coordinates
Vector3 Camera. Main. WorldToViewportPoint ();
//4. The viewport to turn the world coordinates,
Vector3 Camera. Main. ViewportToWorldPoint (new Vector3 (viewPortPos. X, viewPortPos. J y, zInfo));
//5. Viewport turn screen coordinates
Vector3 Camera. Main. ViewportToScreenPoint ();
//6. Screen on viewport coordinates
Vector3 Camera. Main. ScreenToViewportPoint ();
  • Related