Game Development Community

Getting smooth zooming...

by Kaya Dogan · in Torque Game Engine · 05/28/2006 (4:52 am) · 2 replies

After merging the zooming 3rd person camera and modifying a bit, I noticed, that the zoom is not as smooth as we want it to be. Here's the code, which is being executed in the default.bind.cs:

//Camera Zoom in and out, 3rd person view - Mouse Wheel
function handleMouseWheel(%val)
{
   // Check if the wheel scrolled up or down
   if( %val > 0 )
         commandToServer('ZoomInCamera'); //Mwheel Up

   else
         commandToServer( 'ZoomOutCamera' );//Mwheel Down

}

moveMap.bind(mouse, "zaxis", handleMouseWheel );

We tried with schedule() but failed. Maybe you can help us by giving us the right direction or maybe some code.
Thanks in advance.

#1
05/28/2006 (5:17 am)
That code doesn't show anything to do with zooming. It's just telling us you bound the mousewheel to a zoom in and zoom out function. These are the functions we need to see.

To get smooth zooming I use a switch statement which increments / decrements the FOV by small amounts each time the appropriate function bound to the mwheel is called.
#2
05/28/2006 (5:31 am)
We basically use the following resource for zooming camera:

http://www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=3428

I just modified the engine-sources, so the value given to the zoom function will be divided by 10, so +1 becomes +0.1 in order to make it scroll a bit slower.