3D camera curve zoom

A528d11e2590c45b74a53dadde386125
0
Xcrypt 101 Mar 16, 2012 at 01:40

I’m not sure whether this belongs to the math section or graphics section, but I decided to put it here.

I’m making a 3D RTS with some fellow students, and I would like to achieve a camera zoom function identical to that of the Command&Conquer3 game

The camera can rotate around the world’s up axis, it can move around the xz-plane (directX coord system)

and zooming goes like this:

http://i42.tinypic.com/34fei3o.jpg

So it’s not really a zoom, you just translate the camera closer to the terrain. The look vector of the camera would be the tangent to the function at that point.

I can’t really figure out a way to do it, I’ve been thinking I might achieve something like it with calculus,
where the yPosition, (as well as x & z position, depending on the rotation) of the camera, and the angle of look vector of the camera relative to an xz-plane would be an output of the function, with as input the zoom amount(0.0f->1.0f).
But I’m not sure at all what function I would have to take.

Aside from that, the question rises on how to handle bounds-checking when your position of the camera is really divided up into two parts: it’s actual position, and the position of a point on the function, since you don’t want to get to a point where you can’t zoom in any further due to the camera getting out of bounds.

So, what would be a proper way to implement this?

EDIT: example: at (2:14), (6:46), (6:52), (8:03), (8:16)
(you have to be attentive to spot the movement though)
[media]http://www.youtube.com/watch?v=ySzM8g_yEQQ[/media]

0 Replies

Please log in or register to post a reply.

No replies have been made yet.