What is the difference between Unity's Camera.ScreenPointToRay and Camera.ScreenToWorldPoint. And where we can use these. I've watched some tutorial and documentation but I didn't get a clear understanding.

  • \$\begingroup\$ The documentation is quite clear: ScreenPointToRay: Returns a ray going from camera through a screen point. ScreenToWorldPoint: Transforms 'position' from screen space into world space. \$\endgroup\$ – Hellium May 14 '18 at 14:10
  • \$\begingroup\$ @Hellium Thank you so much for your response now I've got the meaning. \$\endgroup\$ – Abhinay Singh Negi May 15 '18 at 16:29

ScreenPointToRay returns a ray, basically something pointing in the direction of the mouse from the location of the camera.

ScreenToWorldPoint point actually returns a 3d position under the mouse.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.