{"author_name":"AnonymousJoe","cat":"LD #30","comments":[{"author_name":"plash","time":"August 22, 2014 12:53 pm","epoch":1408729980,"text":"Cool! Have fun.","spam":"N"}],"epoch":1408729620,"likes":0,"metadata":{"p_key":"28784","p_author":"AnonymousJoe","p_authorkey":"502696","p_urlkey":"64239","p_title":"New here! Gonna give it a shot.","p_cat":"LD #30","p_event":"LD30","p_time":"1408729620","p_likes":"0","p_comments":"1","p_status":"UPD5","us_key":"502696","us_name":"anonymousjoe","us_username":"anonymousjoe","event_start":"1408665600","event_key":"24","event_name":"LD30"},"text":"<p>Always wanted to do one of these. \u00a0I have almost no experience, but I&#8217;m picking up Unity pretty quick. \u00a0The rules said to post any code we&#8217;ll be using, so here&#8217;s my First Person Controller, which is a modified version of\u00a0Quill18&#8217;s amazing video tutorial:<\/p>\n <p><code><br \/>\n using UnityEngine;<br \/>\n using System.Collections;<\/p>\n <p>public class FirstPersonControllerV2 : MonoBehaviour {<\/p>\n <p>CharacterController player;<\/p>\n <p>float verticalvelocity = 0;<br \/>\n float pitchlook = 0;<br \/>\n float wsspeed = 0;<br \/>\n float adspeed = 0;<br \/>\n float jumpspeed = 0;<br \/>\n float falsegravity = 9.81f;<\/p>\n <p>public float mousesensitivity = 5.5f;<br \/>\n \/\/ Use this for initialization<br \/>\n void Start () {<\/p>\n <p>Screen.lockCursor = true;<br \/>\n player = GetComponent();<br \/>\n }<\/p>\n <p>\/\/ Update is called once per frame<br \/>\n void Update () {<\/p>\n <p>\/\/MouseX<br \/>\n float yawlook = Input.GetAxis(\"MouseX\") * mousesensitivity;<br \/>\n transform.Rotate(0,yawlook,0);<\/p>\n <p>\/\/MouseY<br \/>\n pitchlook -= Input.GetAxis(\"MouseY\") * mousesensitivity;<br \/>\n pitchlook = Mathf.Clamp(pitchlook, -60, 60);<br \/>\n Camera.main.transform.localRotation = Quaternion.Euler(pitchlook,0,0);<\/p>\n <p>\/\/Gravity<br \/>\n verticalvelocity -= falsegravity * Time.deltaTime;<\/p>\n <p>\/\/Movement<br \/>\n if(player.isGrounded){<br \/>\n falsegravity = 8.81f;<br \/>\n if(Input.GetKey(KeyCode.LeftShift)){<br \/>\n wsspeed = Input.GetAxis(\"Vertical\") * 17.5f;<br \/>\n adspeed = Input.GetAxis(\"Horizontal\") * 17.5f;<br \/>\n }<br \/>\n else{<br \/>\n wsspeed = Input.GetAxis(\"Vertical\") * 9.6f;<br \/>\n adspeed = Input.GetAxis(\"Horizontal\") * 9.6f;<br \/>\n }<\/p>\n <p>\/\/Jumping<br \/>\n if(Input.GetButtonDown(\"Jump\")){<br \/>\n falsegravity = 35f;<br \/>\n verticalvelocity = 15f;<br \/>\n if(Input.GetKey(KeyCode.LeftShift)){<br \/>\n jumpspeed = 17.5f;<br \/>\n }<br \/>\n else{<br \/>\n jumpspeed = 9.6f;<br \/>\n }<br \/>\n }<br \/>\n }<br \/>\n else{<br \/>\n wsspeed = Input.GetAxis(\"AirVertical\") * jumpspeed;<br \/>\n adspeed = Input.GetAxis(\"AirHorizontal\") * jumpspeed;<br \/>\n }<\/p>\n <p>Vector3 speed = new Vector3(adspeed, verticalvelocity, wsspeed);<br \/>\n speed = transform.rotation * speed;<br \/>\n player.Move(speed * Time.deltaTime);<br \/>\n }<br \/>\n }<br \/>\n <\/code><\/p>\n <p>The modifications were made to make the movement much faster when sprinting while giving it a more &#8220;DOOM-y&#8221; feel.  By altering the gravity and sensitivity of the different input axes in &#8220;Edit&gt; Project Settings&gt; Input&#8221; you can give the movement the same slide as older FPS games, or disable it altogether.  You will need to create two new Axes in that editor called &#8220;AirHorizontal&#8221; and &#8220;AirVertical&#8221; and copy the settings of &#8220;Horizontal&#8221; and &#8220;Vertical&#8221; exactly.  Then by altering the Sensitivity and Gravity settings, Jumping can have a different level of precision as running without changing the actual speed of movement.  For me, that means ground movement has instant change and a slight slide when stopping, while jumping requires time to change direction, but speed is maintained. <\/p>\n <p>Hope this helps somebody else!<\/p>","time":"August 22nd, 2014 12:47 pm","title":"New here! Gonna give it a shot."}