Page 1 of 1

Zoom camera

Posted: Mon Dec 28, 2009 10:43 pm
by saturn1
Hello guy,
I wonder what is necessary for do a real fluid zoom.

For the moment i do

Code: Select all

 cameraOffset = new Vector3(-camera.getForwardVector().X, 0.9f, -camera.getForwardVector().Z * camera.zoomCamera);
And when the user scroll the wheel mouse i change camera.zoomCamera and it works good.

But it works by yank !

And i wonder if to make a zoom like for example the camera is
Begin : Z = 0
End : Z = 100

To move fluid the camera !

I think i need to create a thread which increase the value of the zoom camera each 0.1s from 0 to 100 for example !

Thank you for help :=)

Re: Zoom camera

Posted: Mon Dec 28, 2009 11:08 pm
by Norbo
I wouldn't recommend using a second thread. Instead, specify a 'goal' position. In each update call, move the camera towards the goal position by some increment (like cameraZoomSpeed * dt).

You'll also probably need to deal with the case where your camera is less than one step away from the goal position. Instead of moving a whole step towards it, which could overshoot and cause visible jittering, you can move only enough to get there.