1. Post #1
    Blue and Proud Of It.
    Dennab
    September 2011
    961 Posts
    Hello!

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

    I tried:

    p:SetFOV(90) -- Courtesy of NewBee
    

    But it didn't work... :(

    Any Help?

  2. Post #2
    Blue and Proud Of It.
    Dennab
    September 2011
    961 Posts
    Any help?

  3. Post #3
    Casual Bananas
    E X C L's Avatar
    February 2011
    1,716 Posts
    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)

  4. Post #4
    Derek_SM's Avatar
    January 2011
    330 Posts
    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:
    hook.Add("PlayerInitialSpawn", "JenkinsSetFOV", function(pl)
    	
    	pl:ChatPrint( "My FOV before: " .. pl:GetFOV() )
    	pl:SetFOV( 90 )
    	pl:ChatPrint( "My FOV now: " .. pl:GetFOV() )
    
    end)
    

    But using this one actually says it and sets it properly:
    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)
    

  5. Post #5
    Blue and Proud Of It.
    Dennab
    September 2011
    961 Posts
    I love you
    Reply With Quote Edit / Delete Reply United Kingdom Show Events Optimistic Optimistic x 1Funny Funny x 1 (list)