Interesting 3d zooming technique
Posted
by
stark
on Game Development
See other posts from Game Development
or by stark
Published on 2012-06-09T21:19:43Z
Indexed on
2012/06/09
22:48 UTC
Read the original article
Hit count: 272
Is it possible to zoom to a certain point on screen by modifying the field of view and rotating the camera as to keep that point/object in the same place on screen while zooming ? Changing the camera position is not allowed..
I projected the 3d pos of the object on screen and remembered it.
Then on each frame I calculate the direction to it in camera space and then I construct a rotation matrix to align this direction to Z axis (in cam space).
After this, I calculate the direction from the camera to the object in world space and transform this vector with the matrix I obtained earlier and then use this final vector as the camera's new direction.
And it's actually "kinda working", the problem is that it is more/less off than the camera's rotation before starting to zoom depending on the area you are trying to zoom in (larger error on edges/corners).
It looks acceptable, but I'm not settling for only this. Any suggestions/resources for doing this technique perfectly ? If some of you want to explain the math in detail, be my guests, I can understand these things well.
Thanks.
Edit: I'll check often for responses, I'm really curious about this :D
© Game Development or respective owner