Topic: set pan and tilt to match camera rotation

I mouse drag the panoramic, on Update I set main camera rotation equal to the panoramic camera rotation. Both cameras are now in sync and good.

1) Main camera,
2) panoramic camera

However when I first enable the panoramic and cam, how can I translate the main cameras rotation to the pan and tilt values to set the panoramic what angle it should begin?

Re: set pan and tilt to match camera rotation

Hello.

Create a ray from the camera, use Physics.Raycast to find the point of intersection with the panorama, and use PanoRenderer.GetPanTiltByWorldPosition to convert the point to pan and tilt.
http://infinity-code.com/doxygen/upano/ … 98a694fad9

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: set pan and tilt to match camera rotation

thanks! that did it. Honestly I'm not even sure how it works but it does haha.

instead of physics ray i did this which I assume is the same logic and seems to work so far.

       

            float pan;
            float tilt;
            Vector3 pos =cam.transform.position + cam.transform.forward * panoRenderer.radius;
            panoRenderer.GetPanTiltByWorldPosition(pos, out pan, out tilt);
            panoRenderer.pano.pan = pan;
            panoRenderer.pano.tilt = tilt;

       
I set this up a few weeks back and had to do some translation of the rotations based on the master file text that it came with. Its all working now but something happens with that translation when I go around a corner the North must change or something where I would end up "jumping" a bit when panning with the mouse because although my camera angle didn't change the pan/tilt values do. so when i go to drag view it jumps at first

sorry long description but anyway if I call this method and reset the pan/tilt to match the camera angle each time that seems to be good.

Re: set pan and tilt to match camera rotation

If this is a question or a description of a problem, then I unfortunately did not understand it.
Try to rephrase it. And a little video showing the problem, I think will help a lot here.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: set pan and tilt to match camera rotation

I think im all set its working now thanks for the help