Game Development Community

Tank Pack - FOV, Zoom problem - setfov fix

by kcpdad · in Torque Game Engine · 11/19/2006 (5:21 am) · 0 replies

The Torquescript call setfov(value) does not work with tanks from the tank pack. Raverix suggested this fix over the IRC channel. I tested it and it looks good. To fix just delete all the lines from tankShape.cc and tankShape.h that mention fov. It seems the fov code in the tank pack is legacy and doesn't provide any useful functionality.
Here is a diff of engine files that need to be changed.
C:\temp>diff tankShape.cc tankShape.cc.nofov
758d757
<    camFov = 90.0f;
777d775
<    addField("camFov", TypeF32, Offset(camFov,TankCameraData));
800d797
<    stream->write(camFov);
819d815
<    stream->read(&camFov);

C:\temp>diff tankShape.h tankShape.h.nofov
166d165
<    F32 camFov;            // camera field of view, in degrees
437,438d435
<    F32  getCameraFov()        { return getDataBlock()->camera->camFov; }
<    F32  getDefaultCameraFov() { return getDataBlock()->camera->camFov; }
To test, execute the setfov(somevalue) call on the client side and you should see you view increase or decrease (zoom)
setfov(110);
setfov(20);

Again, thanks to Raverix for providing the fix.

About the author

Hobbyist working on a tank game when time allows. Play the prototype at => http://www.sytrept.com/60tons/