Help with Setting the FOV

Hello!

I would like to set the FOV of a player upon connect:

I tried:

[LUA]
p:SetFOV(90) – Courtesy of NewBee
[/LUA]

But it didn’t work… :frowning:

Any Help?

Any help?

You can easily set the FOV in calcview, the problem is that when you do this there is a bug in Entity.GetEyeTrace where it does not properly calculate the cursor position in the world with your new FOV.

You could try to set it with CalcView and then override Entity.GetEyeTrace to work with a new cursor calculation.

(assuming you need this for that thing I sent you)

Using a timer.Simple fixes it. I don’t know of a better way really, I haven’t tested enough.

Using this would say your FOV is now 90, but it doesn’t actually set it:
[lua]
hook.Add(“PlayerInitialSpawn”, “JenkinsSetFOV”, function(pl)

pl:ChatPrint( "My FOV before: " .. pl:GetFOV() )
pl:SetFOV( 90 )
pl:ChatPrint( "My FOV now: " .. pl:GetFOV() )

end)
[/lua]

But using this one actually says it and sets it properly:
[lua]
hook.Add(“PlayerInitialSpawn”, “JenkinsSetFOV”, function(pl)

timer.Simple(0, function()
	pl:ChatPrint( "My FOV before: " .. pl:GetFOV() )
	pl:SetFOV( 90 )
	pl:ChatPrint( "My FOV now: " .. pl:GetFOV() )
end)

end)
[/lua]

I love you