Im using an a-sky element to display a 360° photosphere.
My problem is that I have to place inside the photosphere some elements that must act like 'markers'; but I do not understand how to calculate the x-y-z
position of those elements.
For example, lets say that I have a picture with size 4096x2048 and I want to place a simple box at 169,1349.
I know the radius of the sphere (5000), i know the size of the box (I can choose a convenient size), I only know how to retrieve the position of that "pixel position" (169,1349) inside the sphere.
Any hints?
If you want to calculate position on the a-sky sphere surface, I have a method. make a ray from camera's position, and this ray will hit on sphere. this hit point is the position that we want to calculate. the code is like:
Sorry for answering my own question but this time was really easy:
Where
distance
is the distance from the centre (camera) where we want to put our element.Just for the records, the opposite function is:
The original functions can be found here: mistic100/Photo-Sphere-Viewer (there are also nice functions to get the position of the element inside the screen)