Michael, I've looked, as you said to fov and frustrum and found some
useful tips. I've calculated that the camera's vertical view angle is
about 50 degrees. I thought this would solve my problems, since after
testing about five panorama files, the angles seemed to fit almost
perfectly.
The viewer works like this: i load the panorama, when it finishes, i
create a cylinder (this._radius = this._image.width / (Math.PI * 2);
this._height = this._image.height;) put the camera in the middle of it
and turn the cylinder on the Y axis. The camera's rotationX is set by
the mouse's Y position on the stage:

this._view.camera.rotationX = (stage.mouseY - stage.stageHeight / 2) /
(stage.stageHeight / 2) // this.returns a value between -1 and 1
                                            *
(Math.atan(this._height / 2 / this._radius) * 180 / Math.PI - 25); //
this calculates the angle till which the camera can tilt on the X
axis. the -25 is there because the camera's vertical view angle is
around 50 degrees, and this is half of it.

As mentioned before, this works well, but when i load an image with
the resolution of 2101x400, the camera seems to turn too much.
Here's an image to help: http://www.symbio.cz/camera/cam.jpg
With this image i have a radius of ~334 and height of 400. From this,
i get the 30 degree angle. Then, knowing that the camera has a 50
degrees view angle vertically, i divide 50 by 2 (we're only talking
about the part above the X axis) and the diference of ~5 degrees
should be the delta, where the camera can rotate.
Shortly: this._view.camera.rotationX is between -5 and 5. This makes
sense like this and seems to be correct, but as you can see on this
image: http://www.symbio.cz/camera/pano.jpg, it looks as if the camera
turned too much.

So, do you think this is a good approach to calculate the limits of
the rotationX? What would you suggest?

Thanks a bunch, i dont know who to turn to anymore :)
Z.


On Oct 27, 5:52 pm, Darcey Lloyd <[email protected]> wrote:
> Will these values match hovercamera pan and tilt angles? I was trying to
> synchronise a hover and camera3D a few weeks back but I ended up cooking up
> an alternate solution to overcome the problem.
>
> Ty
>
> D
>
> On 27 October 2010 14:35, Michael Iv <[email protected]> wrote:
>
>
>
>
>
>
>
> > Look at frustum and fov calcs in wiki
>
> > Sent from my iPhone
>
> > On Oct 27, 2010, at 3:19 PM, pallzoltan <[email protected]> wrote:
>
> > > ok, i've drawn it:http://www.symbio.cz/camera/camera.jpg
> > > you're describing alpha, and i am looking for beta
>
> > > On Oct 27, 3:00 pm, Michael Iv <[email protected]> wrote:
> > >> If I get you ,you need an angle of rotation of the camera relative to
> > the
> > >> center point at which it looks ,right?
> > >> You can write the initial rotations of the camera before it was rotated
> > and
> > >> then calculate delta rotation for each axis when you rotate the
> > camera.This
> > >> is easiest .
>
> > >> On Wed, Oct 27, 2010 at 2:56 PM, pallzoltan <[email protected]>
> > wrote:
> > >>> nono, look here:
> > >>>http://upload.wikimedia.org/wikipedia/en/7/72/Angle_of_view.svg
> > >>> i need the vertical angle (from top to bottom). i need it because i'm
> > >>> building a panorama viewer and the loaded images always have different
> > >>> ratio. therefore i need to know how much i can rotate the camera on
> > >>> the X axis
> > >>> maybe you can think of an easier way?
>
> > >>> Z.
>
> > >>> On Oct 27, 2:51 pm, Michael Iv <[email protected]> wrote:
> > >>>> do you  mean camera forward look view angle relative to some object ?
> > use
> > >>>> dot product
>
> > >>>> On Wed, Oct 27, 2010 at 1:50 PM, pallzoltan <[email protected]>
> > >>> wrote:
> > >>>>> hello there :)
>
> > >>>>> i can't seem to figure out what the view angle of the camera is, and
> > >>>>> this seems to be such a basic need that i feel like i've surely
> > missed
> > >>>>> something. i guess it's somehow calculated from the camera's
> > >>>>> parameters (fov, focus, zoom)
>
> > >>>>> thanks for any kind help
> > >>>>> Z.
>
> > >>>> --
> > >>>> Michael Ivanov ,Programmer
> > >>>> Neurotech Solutions Ltd.
> > >>>> Flex|Air
> > >>> |3D|Unity|www.neurotechresearch.comhttp://blog.alladvanced.nethttp://
> > >>>www.meetup.com/GO3D-Games-Opensource-3D/
> > >>>> Tel:054-4962254
> > >>>> [email protected]
> > >>>> [email protected]
>
> > >> --
> > >> Michael Ivanov ,Programmer
> > >> Neurotech Solutions Ltd.
> > >> Flex|Air
> > |3D|Unity|www.neurotechresearch.comhttp://blog.alladvanced.nethttp://
> >www.meetup.com/GO3D-Games-Opensource-3D/
> > >> Tel:054-4962254
> > >> [email protected]
> > >> [email protected]

Reply via email to