• 3rd Person default (DarkRP)
    4 replies, posted
Hello Facepunch! I was curious as to how I would go about creating a server in which your point of view is by default 3rd person? I snooped around some files but i'm not able to find the appropriate way to go about it. Thank you!
[URL="http://wiki.garrysmod.com/page/GM/CalcView"]GM.CalcView[/URL] [URL="http://wiki.garrysmod.com/page/GM/ShouldDrawLocalPlayer"]GM.ShouldDrawLocalPlayer[/URL] Alternatively use [URL="http://wiki.garrysmod.com/page/Global/CreateClientConVar"]CreateClientConvar[/URL] as a way to toggle it, and read its value by using [URL="http://wiki.garrysmod.com/page/ConVar/GetBool"]ConVar.GetBool[/URL]
[QUOTE=McDunkable;49977286][URL="http://wiki.garrysmod.com/page/GM/CalcView"]GM.CalcView[/URL] [URL="http://wiki.garrysmod.com/page/GM/ShouldDrawLocalPlayer"]GM.ShouldDrawLocalPlayer[/URL] Alternatively use [URL="http://wiki.garrysmod.com/page/Global/CreateClientConVar"]CreateClientConvar[/URL] as a way to toggle it, and read its value by using [URL="http://wiki.garrysmod.com/page/ConVar/GetBool"]ConVar.GetBool[/URL][/QUOTE] Without sounding like a complete utter moron, I took a look at every single link, and could not figure out how to set it up too well. I apologize
Alright, that's okay. GM.CalcView is the function used to override the player's eyepos, eyeangles, and on rare occasions, fov. But the most common uses are origin and angles. The Wiki's CalcView example itself is a third person camera positioned 100 units behind the original position and rotates around that axis naturally, being that it is moved 100 units back not by setting a vector and using what we call "magic numbers" but instead, it gets the angles forward vector ( The angle in this case is the player's general viewing direction ) and multiplies it by 100. The reason it moves back is because as stated, pos is to subtract the product of the angle's forward by 100. GM.ShowDrawLocalPlayer is to override whether the local player ( Only yourself ) is to be rendered or not. It is very simple to use, and all you need to do is return either a true or false value, true being YES render the player, false being NO don't render the player. ( Note that CalcView is able to do the same by adding drawviewer onto the View table, use whichever method you want ) By default, ShowDrawLocalPlayer returns false, as we don't want to render the player in first person, which is why I have to bring it up, you do want the player to render in third person. I then suggested CreateClientConvar. The purpose being, people can toggle their third person by entering a console command, the same way you could run a command on them to toggle it for them. But this is entirely optional, if your third person is to be on at all times, then this is redundant and you can disregard it. Those are the basics, but it gets more complicated. Because you are moving the camera a desired amount of units in whichever direction, you also have to account for the camera being outside the world. I'll get into that once you can get the basics working.
[QUOTE=McDunkable;49979240]Alright, that's okay. GM.CalcView is the function used to override the player's eyepos, eyeangles, and on rare occasions, fov. But the most common uses are origin and angles. The Wiki's CalcView example itself is a third person camera positioned 100 units behind the original position and rotates around that axis naturally, being that it is moved 100 units back not by setting a vector and using what we call "magic numbers" but instead, it gets the angles forward vector ( The angle in this case is the player's general viewing direction ) and multiplies it by 100. The reason it moves back is because as stated, pos is to subtract the product of the angle's forward by 100. GM.ShowDrawLocalPlayer is to override whether the local player ( Only yourself ) is to be rendered or not. It is very simple to use, and all you need to do is return either a true or false value, true being YES render the player, false being NO don't render the player. ( Note that CalcView is able to do the same by adding drawviewer onto the View table, use whichever method you want ) By default, ShowDrawLocalPlayer returns false, as we don't want to render the player in first person, which is why I have to bring it up, you do want the player to render in third person. I then suggested CreateClientConvar. The purpose being, people can toggle their third person by entering a console command, the same way you could run a command on them to toggle it for them. But this is entirely optional, if your third person is to be on at all times, then this is redundant and you can disregard it. Those are the basics, but it gets more complicated. Because you are moving the camera a desired amount of units in whichever direction, you also have to account for the camera being outside the world. I'll get into that once you can get the basics working.[/QUOTE] I appreciate your well-detailed response! Will give it a go.
Sorry, you need to Log In to post a reply to this thread.