Get player's field of view (fov)?

Discuss programming in the QuakeC language.
Post Reply
Slackhead
Posts: 2
Joined: Tue Sep 09, 2014 10:58 pm

Get player's field of view (fov)?

Post by Slackhead »

Hi, I've not managed to find anything on this, but I want to make a zoom function on a weapon and I would like to first find the player's normal FOV so i can restore it afterwards to whatever they had set it as.

Possible?
Spike
Posts: 2914
Joined: Fri Nov 05, 2004 3:12 am
Location: UK
Contact:

Re: Get player's field of view (fov)?

Post by Spike »

no. not possible.
just use .viewzoom instead.

long answer:
stuffcmd(player, "cmd foo $fov\n");
void(string s)SV_ParseClientCommand=
{
tokenize(s);
if (argv(0) == "foo")
sprint(self, "your fov is \"", argv(1), "\"\n");
else
clientcommand(s);
};
of course, as this requires both client and server extensions, both of which basically require an engine that already supports .viewzoom, its generally just better to use .viewzoom instead and not fuck with the client's cvars. those things should be owned by the client and you fucking them up will break configs or whatever if they quit at a bad time.
Slackhead
Posts: 2
Joined: Tue Sep 09, 2014 10:58 pm

Re: Get player's field of view (fov)?

Post by Slackhead »

Thanks, I'll look into that.
Cobalt
Posts: 445
Joined: Wed Jun 10, 2009 2:58 am
Location: New England, USA
Contact:

Re: Get player's field of view (fov)?

Post by Cobalt »

FOV, always been to me in MP sense, a cheat / advantage. Set to > 90 the default, and you have a larger view perspective of the map than someone who does not know or want to use a greater FOV. Accoirding to Wikipedia, we all have approx 95 degree FOV -

http://en.wikipedia.org/wiki/Human_eye
r00k
Posts: 1111
Joined: Sat Nov 13, 2004 10:39 pm

Re: Get player's field of view (fov)?

Post by r00k »

i prefer fov 110 anything less than 100 looks like im running around with reading glasses on.

@Slack:
So if each player's starting FOV value is variable, and all you are really doing is making a Zoom effect, then the best alternative would be to take the difference on your end.

Meaning, decrement the fov value X number of times when zooming, then increment the fov value THAT many times when returning. All you are controlling is the distance from out to in. (slider bar)

Use .viewzoom to change the fov
or
You could simply *cough* stuffcmd to the client "inc fov 1", "dec fov 1"... x number of times in a loop. I know this is not the best option. But would only require a client that has those console commands, which i think most do.
Post Reply