[Solved] How can I make a camera that converts everything it sees into "World Space"?

I’m making some scripts that draw the user’s touch / cursor / etc. on the screen. The thing is I don’t want to use Camera.main.ScreenToWorldPoint. I want to modify the camera itself so that the camera will render everything accurately. How can this be done?

Your question doesn’t really make sense. “World Space” is the 3D world, and “Screen Space” is the 2D image the camera projects onto your screen. The user is touching the phone screen, which is 2D, so unless he pokes his finger through the screen and out the back of his phone, there is no Z coordinate to get. That’s why you do ScreenToWorldPoint.

Sorry I didn’t explain clearly. Basically, I have a script that creates a Trail that follows the user’s finger on the screen. If I convert the touch to WorldPoint, everything displays fine. If I don’t, then the Trail points are in Screen coordinates which are typically from x 200-400 and y 100-200 so I don’t see them on my normal camera. However, if I move the camera’s transform’s x-position to 300 and y to 150 and change its size to about 200 (it’s an Ortographic cam) then I’m able to see the trail just fine. So what I wanted was to know if there was a way to convert the camera’s size and transform position so that it would render accurately on the screen objects that are drawn in Screen Space coordinates.

Solved. First, we need to center the camera:

            var screenCenter = new Vector3(Screen.width/2f, Screen.height/2f, transform.position.z);
            transform.position = screenCenter;

This will set the camera at the center of the screen.

Next, we need to change the camera’s size to capture the whole screen:

GetComponent<Camera>().orthographicSize = Screen.height/pixelsToUnits/2;

Put it all in one script in Awake or Start on the Camera GameObject and your camera should capture GameObjects created in screen space coordinates.