- Home /
WorldToScreenPoint / Rays with stereoscopic 3D
In a stereoscopic scene you need to have two different cameras (according to the left and right eye). Hence you have two differing points when using WorldToScreenPoint
(at least as far as I understand).
Will camera.WorldToScreenPoint(transform.position)
still work or do I have to use another command to get the result? Or can Unity cope with stereoscopic set up and still give a correct result?
Further: What is the effect on Rays?
Even further: may the result differ when using MiddleVR?
Answer by Paul Graystone · Mar 26, 2013 at 09:42 AM
Since I did enough trying/ testing I came up with a quite simple but effective solution. I think this solution only works with MiddleVR, but I do not know for sure since I could not test any other set up.
In the case of MiddleVR two cameras are needed to render a stereoscopic image. But nevertheless you can place a third camera, which can be located between the camera for the left and right eye. This third camera can be used as the ray-perfoming and WorldToScreenPoint-performing camera. It will not render any image. Hence one does not need to rewrite code to fit a game to stereoscopic 3D.
Answer by FatWednesday · Jan 26, 2013 at 02:35 PM
WorldToScreenPoint would still work...in a way, since its a method of a camera instance, the result would simply depend on which of the two cameras you when calling the function.
Depending on the separation distance between the cameras, it may be perfectly acceptable for you to just pick one of the cameras and go for it, but if accuracy is a key importance, then you may be better off performing the function on both cameras, and using both results to then work out where on the screen the point is (so the midpoint between the two results).
Never used/looked at MiddleVR though so i cant offer any input there.
Thank you for your answers. That calms me :).
$$anonymous$$aybe calculating the midpoint between the two cameras provide the necessary precision.
The midpoint of the two results approach is definitely the way I would go off the top of my head. As for how well that works in practice as opposed to theory, best way to find that out is just dive in a test it :).
@FatWednesday: Your answer led me to an effective solution. I used a third camera, that is placed between the two other cameras. Please check my answer for further information.
Thank you for your help!
Your answer
![](https://koobas.hobune.stream/wayback/20220613091623im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Change screen resolution button in pause menu? 0 Answers
Raycasting to turn varible on and OFF 1 Answer
Getting the Furthest Point on a Ray 1 Answer
Find Location 0 Answers