Game Development Community

How do I increase the ZOOM distance ?

by Jeff Yaskus · in Torque 3D Professional · 10/29/2011 (8:11 pm) · 5 replies

Anyone know what/how to modify things - so the "zoom" function actually zooms in much more distance than stock?

edit: I found the code in scripts/client/default.bind.cs ... but not seeing the solution?!

[/code]
//------------------------------------------------------------------------------
// Zoom and FOV functions
//------------------------------------------------------------------------------
...
function toggleZoom(%val)
{
if (%val)
{
ServerConnection.zoomed = true;
setFov($Pref::Player::CurrentFOV);
Reticle.setVisible(false);
zoomReticle.setVisible(true);

DOFPostEffect.setAutoFocus( true );
DOFPostEffect.setFocusParams( 0.5, 0.5, 50, 500, -5, 5 ); // Change something here ?? //
DOFPostEffect.enable();
}
...
}
[/code]

#1
10/29/2011 (9:06 pm)
Search "FOV" in the CHM Script Manual.

Also ....
setFov($Pref::Player::CurrentFOV);
... $Pref, so look in the prefs.cs or default.cs (I think that's where it gets the stock pref globals from).
#2
10/29/2011 (9:53 pm)
nevermind! duh, should have tried it first - Z to zoom in, F to toggle the zoom levels ... lack of sleep must be showing ... still have zombies on the brain
#3
10/30/2011 (7:50 am)
A better one - track down crouch and how to make it a toggle.... lol - I hate those $mvTriggerCount functions!
#4
10/30/2011 (9:15 am)
The code for this is found in default.bind.cs -- I think I even wrote a couple lines commenting how it worked. toggleZoomFOV() should be found right before toggleZoom().

The way I wrote the toggleZoomFOV function simply takes the current FOV and divides it by 2. This can be done as many times until the currentFOV is less than 5, then it resets to one-half of defaultFOV. I set the limit to 5 because older versions of Torque had nasty crashy issues with FOV's less than 4. Old style FOV zoom simply switched between 3 differentsettings.

Default values for preferences will usually be found in default.cs if a default is defined. If one is not found there then other code somewhere sets/defines the default for the preference and the $pref global will end up stored in prefs.cs
#5
10/30/2011 (9:19 am)
I forget the old Torque defaults for the keybinds... but I do remember that I ended up changing them due to conflicts with other developers snatching up keybinds without regard to existing ones.

I tried to make the ones I changed logical to their assigned key, so Z for zoom, F for FOV, V for vanity view, etc.