Page 1 of 1

Zoom only first person camera

Posted: Sat Mar 28, 2020 9:11 pm
by Sir_Skurpsalot
I noticed setFov changes the fov of both the first and third person cameras. Is there any way to independently change the fov of the first person camera? Thanks for reading.

Re: Zoom only first person camera

Posted: Sun Mar 29, 2020 1:15 am
by Bloodknight
In default.bind.cs you have this bunch of functions and settings.

You could add a check in the camera toggle function which I don't think I've posted, or you could check the camera mode inside of the FoV function, i'd probably do the former, but each game is different.

Code: Select all

//------------------------------------------------------------------------------ // Zoom and FOV functions //------------------------------------------------------------------------------ if($Player::CurrentFOV $= "") $Player::CurrentFOV = $pref::Player::DefaultFOV / 2; // toggleZoomFOV() works by dividing the CurrentFOV by 2. Each time that this // toggle is hit it simply divides the CurrentFOV by 2 once again. If the // FOV is reduced below a certain threshold then it resets to equal half of the // DefaultFOV value. This gives us 4 zoom levels to cycle through. function toggleZoomFOV() { $Player::CurrentFOV = $Player::CurrentFOV / 2; if($Player::CurrentFOV < 5) resetCurrentFOV(); if(ServerConnection.zoomed) setFOV($Player::CurrentFOV); else { setFov(ServerConnection.getControlCameraDefaultFov()); } } function resetCurrentFOV() { $Player::CurrentFOV = ServerConnection.getControlCameraDefaultFov() / 2; } function turnOffZoom() { ServerConnection.zoomed = false; setFov(ServerConnection.getControlCameraDefaultFov()); Reticle.setVisible(true); zoomReticle.setVisible(false); // Rather than just disable the DOF effect, we want to set it to the level's // preset values. //DOFPostEffect.disable(); ppOptionsUpdateDOFSettings(); } function setZoomFOV(%val) { if(%val) toggleZoomFOV(); } function toggleZoom(%val) { if (%val) { ServerConnection.zoomed = true; setFov($Player::CurrentFOV); Reticle.setVisible(false); zoomReticle.setVisible(true); DOFPostEffect.setAutoFocus( true ); DOFPostEffect.setFocusParams( 0.5, 0.5, 50, 500, -5, 5 ); DOFPostEffect.enable(); } else { turnOffZoom(); } } function mouseButtonZoom(%val) { toggleZoom(%val); } moveMap.bind(keyboard, f, setZoomFOV); // f for field of view moveMap.bind(keyboard, z, toggleZoom); // z for zoom moveMap.bind( mouse, button1, mouseButtonZoom );

Re: Zoom only first person camera

Posted: Sun Mar 29, 2020 12:00 pm
by Duion
The problem here is probably, that there is no first or third person camera and there is just a camera, the only difference is the position of the camera.

So you could duplicate the camera and call one first person camera and one third person camera and then make the FOV function only change one of those.

Another probably not so nice solution is to just reset the FOV if you switch to third person again, you have to test it to see if the lag is tolerable, but the same problem probably exists if you do the other solution.

It depends more on your specific scenario, which I don't know about yet, but I can imagine you zoom aim with a gun in first person and you don't like that it also zooms in third person so you don't want that, since I had the similar issue, but ignored it for now. For that scenario you could try blocking the zoom function in the weapon for third person view.

Re: Zoom only first person camera

Posted: Sun Mar 29, 2020 1:20 pm
by Sir_Skurpsalot
I see, I was afraid that it was just really one camera... Yeah it's aiming related... I should be able to come up with something that just zooms/unzooms you upon toggling cameras then.. thanks.

Re: Zoom only first person camera

Posted: Sun Mar 29, 2020 6:41 pm
by Duion
I would reset the FOV when switching to third person, but you may also want to cancel the aiming image state itself, if you don't want to give the player eventual advantages that come from it, like better accuracy etc.