- Home /
How to get pixel coordinates in case of multiple cameras?
Hi everyone,
I am working on a 360-degree project. We have created 360 degree camera view by stitching 11 cameras around our player. As my object (lets say, a tree) appears in my 360-degree view, I will have to start logging to a file its coordinates on screen (in pixels).
Please let me know the possible way to solve this problem.
Thanks in advance.
usually you just use camera.WorldToScreenPoint to get a position in pixels. if the cameras do not overlap just run it on all cameras. the one camera that actually sees the tree should return pixel values in range and a positive z value.
If WorldToScreenPoint does not work because of the way you stitch the camera's together, you can try using Camera.WorldToViewportPoint ins$$anonymous$$d. This gives coordinates in "fractions" of the camera's view, rather than in pixels: which might be easier to put through your "stitch-together" algorithm, in order to get a final screen-pixel coordinate.
Answer by ElijahShadbolt · Feb 12, 2018 at 08:39 PM
I made an example scene which has a Camera360
script with methods like WorldToScreenPoint
and ScreenToWorldPoint
: