Third Person Shooter (Unity Tutorial) Ep 1 Movement and Camera

This series was originally meant to only be 3 episodes for character movement and animations but is now going to be a full series on creating a third person shooter with enemy AI and a full gameplay loop

More information on the topics covered:
Character Movement:

0:00 Intro
0:43 Important Info
1:09 Scene and Player Setup
1:45 Character Movement
4:09 Testing Movement
4:29 Ground Check
6:31 Gravity
8:45 Setup & Testing Gravity
9:52 Camera Setup
10:45 Rotating the Camera & Player
13:20 Final Camera Setup and Testing
14:27 Outro

67 Comments

  1. oh my oh my! a new channel about Unity! Goodie!! thank you for the videos. Subscribe!!

  2. I'm following your tutorial for my open world game ! Excellent job -Thanks for segregation into chapters.

  3. Gadd Games are you planning to create your own discord server?

  4. I followed your code for the Cinemachine, but it didn't pop up with the menu it did for you?

  5. Great tutorial!
    Use some compression/limiting for your audio. You are very quiet!

  6. don't you have tutorial just like this series where you use the new input system?

  7. Incrível esse tutorial, funcionou de primeiro mesmo tendo o básico em inglês foi o melhor tutorial de todos, continue assim, está de parabéns

  8. why the MonoBehaviour is white and not blue? same for other things they are white not grey

  9. public float moveSpeed = 3f;

    [HideInInspector] public Vector3 dir;

    float hzInput, vInput;

    CharacterController controller;

    [SerializedField] float groundYOffset;

    [SerializedField] LayerMask groundMask;

    Vector3 spherePos;

    [SerializedField] float gravity =-9.81f;

    Vector3 velocity;

    only moveSpeed is showing in inspector. why?????

  10. i typed in everything that was given to me and i keep getting the same 3 errors. someone please help😭

    edit; nvm i was able to get rid of them but got a new one. error cs0103L the name 'controller' does not exist in the current conect
    when should i do?

  11. NullReferenceException: Object reference not set to an instance of an object
    MovementStateManagement.OnDrawGizmos () (at Assets/MovementStateManagement.cs:60)
    UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) i have this problem how i can fix

  12. tip, use GetAxisRaw for a more responsive movement

  13. You don't even have to make a ground check. The Unity CharacterController has it's build in controller.isGrounded. You can just check that with an if statement and handle the rest of the logic in there.

  14. Tell me where I could have messed up, everything works for me, only the inversion on the y axis, when I move the mouse up, the character looks down and vice versa

  15. Honestly mate I've been trying to get my own movement script and follow cam set up for like week now (I only started Unity 3 weeks ago and completely new to scripting) I've watched loaaads of youtube tuts and its either been too confusing or somethings messed up, whatever but this is literally the first video that I've been able to follow start to finish and actually understood what I've done by the end of it. Big thank you for these videos, subbed my guy.

  16. In the gravity part mine appears an error in the code: NullReferenceException: NullReferenceException: Object reference not set to an instance of an object
    MovementStateManager.OnDrawGizmos () (at Assets/animations/Scripts/MovementStateManager.cs:59)
    UnityEditor.DockArea:OnGUI()

    If you can help me solve this even today I will subscribe to the channel and like some videos

  17. 8:00 Just want to add, I've heard it's not good practice to have multiple CharacterController.Move calls in a single update loop as it could potentially cause some instability issues (plus it's really easy to fix). So my solution is to remove the move call from GetDirectionAndMove and Gravity, the in the Update loop after both those methods are called, create a Vector3 finalMove which is the sum of dir * moveSpeed and velocity, then call controller.Move(finalMove * Time.deltaTime)

  18. Theres something wrog with my code please help ive reviewed it so many times

  19. i got some error that said:
    nullreferenceException: object reference not set to an instance of an object movementStateManager.OnDrawGizmos
    can someone help me

  20. i keep on getting errors that say AssetsMovementStateManager.cs(7,29): error CS1519: Invalid token '=' in class, record, struct, or interface member declaration

  21. Crazy beginner question. I'm starting with this video and Googling loads at every step. After creating the Movement State Manager script your screen goes to the place you can type code. What coding program is that?

  22. Yet another tutorial that doesn't work (probably due to Unity's constant annoying updates). It wouldn't let me add a CineMachine Virtual Camera unless I parented it to an object on the hierarchy and it's symbol doesn't appear next to the main camera and it doesn't function. I'm so sick of unity's bullcrap.

  23. please help me I keep on getting an error saying that the variable controller for movement state manager has not been assigned. I'm a beginner and I don't know how to solve this on my own and it wont let me play the game until I fix it. Please help!!!

  24. Hi, i followed all the instructions but i think is the new input system. Look when i put everything and go to check i have a problem that says : Cannot modify the return value of 'Transform.position' because it is not a variable
    Please i need help. 🙁

  25. Bro I'm unable to use Mouse X and Y. I did every step that you did but it dont work. please if you have any idea what i could do pleaaaasee say it to me. thanks

  26. i keep getting the error AssetsMovementStateManager.cs(8,6): error CS0246: The type or namespace name 'hideinspectorAttribute' could not be found (are you missing a using directive or an assembly reference?) what to do?

  27. create fps multiplayer series tutorial using photon pun 2 and mixamo animations please!

  28. Anyone know how to controlee the CM virtual camera here with input from actionMap of new input system?

  29. Hey Gadd, I followed every step of this video exactly but the character doesn't stop moving for a few more seconds even after I took my hands off the controls.
    Here's the code(If there's something that I did wrong, please tell me!):

    MovementStateManager.cs

    using System.Collections;

    using System.Collections.Generic;

    using UnityEngine;

    public class MovementStateManager : MonoBehaviour

    {

    public float movespeed = 3;

    float hzInput, vInput;

    [HideInInspector] public Vector3 dir;

    CharacterController controller;

    [SerializeField] float groundYOffset;

    [SerializeField] LayerMask groundMask;

    Vector3 spherePos;

    [SerializeField] float gravity = -9.81f;

    Vector3 velocity;

    void Start()

    {

    controller = GetComponent<CharacterController>();

    }

    void Update()

    {

    GetDirectionAndMove();

    Gravity();

    }

    void GetDirectionAndMove()

    {

    hzInput = Input.GetAxis("Horizontal");

    vInput = Input.GetAxis("Vertical");

    dir = transform.forward * vInput + transform.right * hzInput;

    controller.Move(dir.normalized * movespeed * Time.deltaTime);

    }

    bool IsGrounded()

    {

    spherePos = new Vector3(transform.position.x, transform.position.y – groundYOffset, transform.position.z);

    if (Physics.CheckSphere(spherePos, controller.radius – 0.05f, groundMask)) return true;

    return false;

    }

    void Gravity()

    {

    if (!IsGrounded()) velocity.y += gravity * Time.deltaTime;

    else if (velocity.y < 0) velocity.y = -2;

    controller.Move(velocity * Time.deltaTime);

    }

    private void OnDrawGizmos()

    {

    Gizmos.color = Color.red;

    Gizmos.DrawWireSphere(spherePos, controller.radius – 0.05f);

    }

    }

  30. no matter what ı do it drops so fast what do ı do ?

  31. the camera always stays in the center of the screen it doesn't follow the player the code is correct i don't know why it doesn't work

  32. Why do you not use rigibody??

  33. Is there a way to make the character rotate only after the camera reaches a certain angle? Trying to recreate Transformers fall of cybertron controls or like Minecraft 3rd person where your player rotates after a certain point

  34. I dont understand why ur voice is low please before making any tutorial at least check your sound

  35. my mouse working opposite when i drag up camera faces down and vice versa any solution ??

Leave a Reply

Your email address will not be published.