Sign in to follow this  
laeuchli

Bird's eye view rotation

Recommended Posts

laeuchli    338
Dear all, I have a simple planet app, and I'd like to rotate from a bird's eye view to a "First person" view. In other words, if I'm looking straight down on a mountain from a bird's eye view, I'd like to rotate my view so I'm looking at it from the PoV of someone at the foot of the mountain. Unfortuantly I'm having some trouble impelmenting this transformation. What I have so far is to add a component: mInternalCamera[13]=(sin(-fabs(mSliderRotationAngle*.75))*105); to the camera matrix. Then after that one can get to the desired view by zooming in and rotating the planet. However, obviously I'd like to automated it so that as one increases mSliderRotationAngle the correct rotation and zoom is applied. Can someone suggest a good method for what I'm trying to do?

Share this post


Link to post
Share on other sites
jyk    2094
Rather than trying to manipulate matrix elements directly as in your example, I would probably try interpolating the orientation and the translation vector separately. For orientation you can use slerp; for translation, you can just interpolate linearly, or use a spline of some sort to get a perhaps more natural motion. For both, you could also apply ease-in-ease-out so that the camera will start and end its motion more smoothly.

Share this post


Link to post
Share on other sites
laeuchli    338
Dear jyk,
Thanks for the advice. I think you are probably right, and I should interpolate, but I'm still not 100% clear on how to produce the correct rotation and translations. When I'm way zooomed out from the planet, I guess I dont really need much in the way of a translation, but I do need a large rotation. When I'm close I think I need a small rotation, and a large translation. Its not clear to me how I could derive the needed amounts other then by trial and error, which seems unlikely to produce good results(And my efforts in that direction have not been very sucessful thus far).
Regards,
Jesse

Share this post


Link to post
Share on other sites
jyk    2094
Quote:
Original post by laeuchli
When I'm way zooomed out from the planet, I guess I dont really need much in the way of a translation, but I do need a large rotation. When I'm close I think I need a small rotation, and a large translation. Its not clear to me how I could derive the needed amounts other then by trial and error, which seems unlikely to produce good results(And my efforts in that direction have not been very sucessful thus far).
I guess I don't know enough about the context to comment on this (I'm not sure what you mean by 'large' and 'small' with regard to rotation and translation here).

All I can really say is that as far as the rate of interpolation goes, you can always apply a function to the interpolating parameter (e.g. 't') to bias it one way or another. This can be an ease-in-ease-out function, or any degree of ease-in or ease-out, the latter of which will push the greater part of the transition towards the beginning or end of the sequence (perhaps this is what you mean by 'larger', but I'm not sure).

Share this post


Link to post
Share on other sites
laeuchli    338
Ah nvm I was creating my rotation matrix incorrectly. I do thank you for the interpolation advice though, it does make things smoother. Thanks again.
Jesse

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this