Zoom camera

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
saturn1
Posts: 34
Joined: Thu Dec 24, 2009 11:14 pm

Zoom camera

Post 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 :=)
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Zoom camera

Post 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.
Post Reply