Why not use "screenToWorldPoint"?

hey codemonkey! First, thank you so much for this great course!
I was wondering what the screenToWorldPoint function actually does and why we aren’t using it… thanks!

That converts a screen position into a world position, but the converted position is on the camera plane and not the world position under the mouse.
You can test it out yourself, do a Camera.main.ScreenToWorldPoint(new Vector3(0, 0, 0)); and it will return the world point right in front of the camera on the lower left corner, regardless of any object that might be close or far from the camera on that lower left corner.
It will not return for example the position on the plane under that camera corner.

1 Like

okay, thanks for clearing that up for me!

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms