World Position always (0.0, 0.0, -10.0)

For some reason my

    Vector3 worldPosition = mainCamera.ScreenToWorldPoint(touchPosition);

always returns the camera position, I even tried copy pasting the tutors github project file code thinking I did something wrong and didn’t notice it but it still makes no difference, it still outputs the same coordinate

Did you set the Simulate Mouse Touches in Window/Analysis/Input Debugger?


1 Like

Thank you for the help!

It wasn’t active (the touch controls still worked for some reason) so it’s possible that was the reason, can’t confirm at the moment because I found an alternative solution.
The ScreenToWorldPoint has an override that lets you input the offset from the camera (apparently it took 0 as the default offset), so inputing 10 as the offset would register the click 10 units in front of the camera, allowing the X and Y coordinates to work normally.

When I get the time I’ll see to revert to the old code now that the touch simulation is active and see if that was the problem.

Privacy & Terms