FIRST PERSON MOVEMENT in Unity - FPS Controller

Поделиться
HTML-код
  • Опубликовано: 26 окт 2019
  • Let's see how to get an FPS Character Controller up and running in no time!
    REGISTER with APPTUTTI: www.apptutti.com/partners/reg...
    LEARN MORE: www.apptutti.com/corporate/?u...
    ● Ultimate FPS asset: assetstore.unity.com/packages...
    ● New Input System: • NEW INPUT SYSTEM in Unity
    ● FPS Shooting: • Shooting with Raycasts...
    ····················································································
    ❤️ Donate: www.paypal.com/donate/?hosted...
    ► Join Discord: / discord
    ● Website: brackeys.com/
    ● Twitter: / brackeystweet
    ● Instagram: / brackeysteam
    ········································­­·······································­·­····
    ► All content by Brackeys is 100% free. We believe that education should be available for everyone.
    ❤️ Donate: www.paypal.com/donate/?hosted...
    ········································­­·······································­·­····
    ♪ "ES_Dress Code_Black - oomiee" by Epidemic Sound

Комментарии • 14 тыс.

  • @Danidev
    @Danidev 4 года назад +15999

    Yeeey you're finally back! Been waiting for this one! :DDD

    • @pharmacist66
      @pharmacist66 4 года назад +427

      Dani Man you’re fast I just got the notification

    • @crowgaming7156
      @crowgaming7156 4 года назад +73

      hi

    • @Beengus
      @Beengus 4 года назад +86

      WHERES MY MOBILE PORTS NERD

    • @user-ob5hj5vn8c
      @user-ob5hj5vn8c 4 года назад +129

      Dani your the man, keep up your devlogs my dude.

    • @AB-hr4qg
      @AB-hr4qg 4 года назад +116

      I played karlson for 2 hours .... idk why

  • @godot-boy7694
    @godot-boy7694 3 года назад +1595

    Mr. Brackeys we noobs will always respect you as our teacher. You left RUclips but you cannot leave our hearts, sir.

    • @BluePhantomGames
      @BluePhantomGames 3 года назад +6

      why is he not responding?

    • @zaimy5779
      @zaimy5779 3 года назад +11

      *salut*

    • @jacobbern9591
      @jacobbern9591 3 года назад +19

      may he teach us trough eventually out dated videos

    • @vozzy06
      @vozzy06 3 года назад +1

      Yash :The Gaming Boy i think he didnt look up his youtube page again

    • @sandroalderucci7949
      @sandroalderucci7949 3 года назад +4

      amen

  • @zeroplayz5525
    @zeroplayz5525 Год назад +74

    Brackey is a legend. I followed 6 different tutorials in order to make a first person controller, I was starting to give up until I remembered your channel and I followed this video. You are the reason why I haven’t given up game development. Thank you.❤

    • @donalodomhnaill
      @donalodomhnaill 8 месяцев назад +4

      Exactly the same here!

    • @FYFTYNDIGITSLoF
      @FYFTYNDIGITSLoF Месяц назад

      I have been searching for ages to find a good movement, I am acutaly saying this as unity is loading so I have faith but idk

  • @RiftCuber01
    @RiftCuber01 Год назад +4

    Really concise, this is the best fps programming tutorial I have seen so far!

  • @None-nh3xb
    @None-nh3xb 3 года назад +2266

    4:51 Mouse Controls
    11:13 Key Controls
    15:14 Gravity
    21:21 Jumping

  • @SrStakeholder
    @SrStakeholder 4 года назад +2290

    I heard that Bethesda offices doesn’t have doors, the staff just clip trough the walls.

    • @mfatihbilhaq4977
      @mfatihbilhaq4977 4 года назад +34

      Yep that required 100$/year.

    • @SubjektDelta
      @SubjektDelta 4 года назад +8

      @Honey Badger Don't Care yes you are, not joking.

    • @skaruts
      @skaruts 4 года назад +17

      lol you made my day. :D

    • @rakodoza7601
      @rakodoza7601 4 года назад +12

      @@skaruts "People will buy everything" - Todd 2018

    • @Cxdyy
      @Cxdyy 4 года назад +3

      Lmaoooooooooooooooooooooooooooooooooooooooooooooooo

  • @wizardstudios7777
    @wizardstudios7777 4 месяца назад +10

    4 years in and this is one of the best movement tutorial that I found out there

  • @stefaniebowles9401
    @stefaniebowles9401 Год назад

    For sure one of the best Unity how-to’s I’ve come across. You break it down so well and make it easy to follow and understand. Definitely subscribing - thanks!

  • @redliam5
    @redliam5 4 года назад +475

    I think Brackeys is psychic, EVERY SINGLE TIME I am going to start a project, he does a tutorial on the exact type of game it is.

    • @zerogaminghq5430
      @zerogaminghq5430 4 года назад +12

      Similar! I think huh what if bracket did first per-
      New video 🤔

    • @thellamawaffle6817
      @thellamawaffle6817 4 года назад +4

      yeah! what is up with that..?

    • @lurtztheorc
      @lurtztheorc 4 года назад +8

      TheLlamaWaffle He has secretly implanted mind reading devices in our brains through us watching his vids. He then uses unity to see what we want.

    • @Gamer-uf1kl
      @Gamer-uf1kl 4 года назад +1

      I am new here so the most types of game i make are here

    • @catacylist2933
      @catacylist2933 4 года назад +4

      What if brackets did a mech game tutorial

  • @herpderp246
    @herpderp246 4 года назад +1131

    me: trying to slowly and methodically type out a script.
    brackeys: I AM SPEED.

    • @StarzzDrak
      @StarzzDrak 4 года назад +6

      bruh i have the same problem except i need to set video speed to 1.25 :D

    • @stupidrobot7386
      @stupidrobot7386 4 года назад +18

      StarzzDrak good for you but.... we didn’t need to know that

    • @StarzzDrak
      @StarzzDrak 4 года назад +2

      @@stupidrobot7386 yes but its life struggle for both of us.. that was the point

    • @SwedishVikingMC
      @SwedishVikingMC 4 года назад +5

      @@StarzzDrak Why are you watching a beginner tutorial if you're a more experienced programmer? lol

    • @StarzzDrak
      @StarzzDrak 4 года назад +13

      @@SwedishVikingMCbruh why not ? I haven't created a single 3d character controller in 3 years

  • @bernardmasika
    @bernardmasika 10 месяцев назад +11

    brackeys explains things with diagrams before starting to demonstrate, such a gem. this tutorial still make sense up to today, well apart the fact that you will have to consider using the new input system. Thanks a lot! i just hope you will be back one day, in publishing tutorials

    • @amanewithjesus5244
      @amanewithjesus5244 10 месяцев назад

      Jesus is lord follow him and you will be saved

    • @Yoctopory
      @Yoctopory 10 месяцев назад +2

      @@amanewithjesus5244 What's wrong with you?

  • @phillipdean9830
    @phillipdean9830 Год назад +4

    Worked perfectly after a few hiccups (probably on my end). So much better explained and implemented compared to this other tutorial I followed. Highly recommended!

  • @thewatermelon_thing7083
    @thewatermelon_thing7083 3 года назад +1316

    Unity: "No errors detected!"
    Me: Falling through the ground at 5000 miles per hour.

  • @Yoctopory
    @Yoctopory 3 года назад +2308

    God creating the universe: "..and of course let's multiply with Time.deltaTime".

  • @random_guy-rz8vz
    @random_guy-rz8vz 2 месяца назад

    I'm making a third person controller with the new Input System and Cinemachine. I finally figured out basic movement but I had no clue how to add jump and gravity mechanics. Your method worked perfectly. Thanks mate!

  • @hmmmmm8716
    @hmmmmm8716 Год назад +3

    My first in-game code ever written, I did complete an online course of C# so I get the basic stuff and some advanced stuff but application in the engine is beyond me. Super helpful tutorial, very happy I found this, Thank You!!!!

    • @SyncroxDeeznuts
      @SyncroxDeeznuts Год назад

      Make sure you add the camera as a child object to the player

    • @Hendrucs
      @Hendrucs Год назад

      Brackeys is a life saver :D

  • @zacoriot
    @zacoriot 3 года назад +1010

    Me: *Runs into an error*
    Me: *Stairs blankly at my code*
    Brain: "Just look up the error on google"
    Me: *continues to stair blankly at my code*
    Brain: "JUST LOOK IT UP"
    Me: "Yeah. your right... Time for a new project"

    • @user-hf6os1qb2w
      @user-hf6os1qb2w 3 года назад +17

      I dunno if you will find it helpfull but with F5 you can run the code and in bottom console it will show you errors

    • @bobdagamer640
      @bobdagamer640 3 года назад +46

      Alt + f4 I believe is good

    • @yeahnope2349
      @yeahnope2349 3 года назад +22

      @@bobdagamer640 For a split second, i went "Huh I didn't know they could do tha-- wait a second...

    • @bobdagamer640
      @bobdagamer640 3 года назад +7

      Lol

    • @kortenue
      @kortenue 3 года назад +5

      I forgot a comma when that almost happened

  • @casssaph2287
    @casssaph2287 3 года назад +736

    me: sees "quaternion"
    me: "ok so basically its black magic and i dont need to know how it works"

    • @youneskasdi
      @youneskasdi 3 года назад +17

      It is in fact one of the coplex parts of game dev you are better off not diging into it if you don't want your head to hurt

    • @dzvidea5065
      @dzvidea5065 3 года назад +43

      @@youneskasdi i did an oopsie... i dug into it
      you weren't wrong, my head hurts

    • @scorpoinlol97
      @scorpoinlol97 3 года назад +6

      @@dzvidea5065 same here

    • @eleazarpeniel1619
      @eleazarpeniel1619 3 года назад +15

      @@youneskasdi I read an article about it and understand absolutely nothing

    • @copperwires9663
      @copperwires9663 3 года назад +2

      I think it's a way of showing positioning on a 4 dimensional axis, which is why it can be used to shoe rotation and position in 3d games

  • @aleksiszaps8423
    @aleksiszaps8423 Год назад

    its realy nice that u explain everything unlike some other youtubers- i just hate it when they start typing with the speed of sound, say nothing abaut what they did and end the vid

  • @Phniblet
    @Phniblet Год назад +1

    The best general unity player movement tutorial on youtube!

  • @basilbravo6361
    @basilbravo6361 3 года назад +865

    me: types the code and follows each step carefully.
    unity: 249 errors take it or leave it.

    • @Mr-px4nz
      @Mr-px4nz 3 года назад +16

      I also have such a problem. Can anyone help with that? :(

    • @liftnop
      @liftnop 3 года назад +12

      use the right case!!!!! I always use caps when i shouldn't too. Message me if you have any of those problems!

    • @tverroryt
      @tverroryt 3 года назад +5

      @@liftnop i have so much erors

    • @liftnop
      @liftnop 3 года назад +19

      @ASMR Darknest then put an ( ; ) there.

    • @sembos1151
      @sembos1151 3 года назад +13

      @@Mr-px4nz using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      public class movement : MonoBehaviour
      {
      public float mouseSensitivity = 100f;
      public Transform playerbody;
      float xRotation = 0f;
      // Start is called before the first frame update
      void Start()
      {
      Cursor.lockState = CursorLockMode.Locked;
      }
      // Update is called once per frame
      void Update()
      {
      float mouseX = Input.GetAxis("Mouse X") * mouseSensitivity * Time.deltaTime;
      float mouseY = Input.GetAxis("Mouse Y") * mouseSensitivity * Time.deltaTime;
      xRotation -= mouseY;
      xRotation = Mathf.Clamp(xRotation, -90f, 90f);
      transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f);
      playerbody.Rotate(Vector3.up * mouseX);
      }

      }

  • @AAlecs
    @AAlecs 3 года назад +88

    me: I will do this by myself
    also me at 12 am: Brackeys tutorial fps movement

    • @labscience8271
      @labscience8271 2 года назад +3

      Hahahha same. I'm a noob. I can't do it without Brackeys

    • @cubecraftgaming9669
      @cubecraftgaming9669 2 года назад +2

      @@labscience8271 Im pretty good at coding, so I tried myself, but 2 days later, 7 cups of coffee drank, and a dead heart, I came to this and it worked! 😁

  • @Youngstupidkid
    @Youngstupidkid Год назад

    I love this tutorial!! I also love all the people who are helping in the comments, great video, great audience, thank you all!

  • @fearedwolf1731
    @fearedwolf1731 Год назад +1

    Brackeys I almost quit watching you becuase I thought unity cost money but now im back and realised your my best source of knowlage.

  • @connorkerrigan3582
    @connorkerrigan3582 4 года назад +271

    i laughed so hard when my guy slowly started floating up into the sky

    • @rexss90
      @rexss90 4 года назад +9

      i have the same problem, can't seem to get the guy on the ground. He either shoots sideways extremely fast or floats

    • @nautics9927
      @nautics9927 4 года назад +6

      @@rexss90 go into your player and make sure the gravity is negative

    • @rexss90
      @rexss90 4 года назад +2

      @@nautics9927 Thanks, i figured it out finally!

    • @CrazyJoven
      @CrazyJoven 4 года назад +2

      @@nautics9927 THANK YOU!!

    • @nautics9927
      @nautics9927 4 года назад +2

      @@CrazyJoven no problem

  • @kieranwiggy2522
    @kieranwiggy2522 4 года назад +875

    Everyone is back here since we are all in quarantine

    • @Dom4321
      @Dom4321 4 года назад +7

      Hell Yeah

    • @unclerandy398
      @unclerandy398 4 года назад +6

      yup

    • @voicehead
      @voicehead 4 года назад +3

      oh yeah

    • @julianeyt4059
      @julianeyt4059 4 года назад +16

      after this is over we will have millions of new game developer XD

    • @aquah2080
      @aquah2080 4 года назад +8

      TF, i just realized i got inspired for gamemaking just because i have too much time with my laptop since the quarantine. Thank you for opening my eyes

  • @Tryftz
    @Tryftz Год назад +1

    Thank you so much Brackeys, your videos are very awesome and helpful and you explain very well what your teaching your students ♥

  • @pugwilldestroygaming9769
    @pugwilldestroygaming9769 Год назад +19

    this tutorial is amazing. im making a game where you explore mars and find aliens and stuff but couldn't figure out how to jump, i ended up using the first part of the tutorial as a "jetpack" and calling it a day

  • @nietzsche14
    @nietzsche14 2 года назад +754

    Me acting like I understand and am not just copying everything he is doing.
    "mhmmmm"

    • @davez2796
      @davez2796 2 года назад +4

      hhahhahah same

    • @sillymortalz
      @sillymortalz 2 года назад +13

      It’s weird, because the third person video’s method or script was so confusing and unknown to me but this one all makes sense?

    • @cubecraftgaming9669
      @cubecraftgaming9669 2 года назад +1

      @@sillymortalz Same XD

    • @lakshyakumar4459
      @lakshyakumar4459 2 года назад +1

      please help my code isnt working

    • @lakshyakumar4459
      @lakshyakumar4459 2 года назад

      if once i added the ycode for it to move p and down only that worked
      it stopped looking aroud i reallycant explain

  • @datblue1104
    @datblue1104 3 года назад +224

    Brackeys: "And now we should be able to move around"
    My Character: " *_YEET gdf bngrsdts ytnw eaygfdfgbv_* "

    • @eddybplayz4801
      @eddybplayz4801 3 года назад +7

      @DRAGO YT GAMING using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      public class PlayerMovement : MonoBehaviour
      {
      public CharacterController controller;
      public float speed = 50f;
      public float gravity = -9.81f;
      Vector3 velocity;
      // Update is called once per frame
      void Update()
      {
      float x = Input.GetAxis("Horizontal");
      float z = Input.GetAxis("Vertical");
      Vector3 move = transform.right * x + transform.forward * z;
      controller.Move(move * speed * Time.deltaTime);
      velocity.y += gravity * Time.deltaTime;
      controller.Move(velocity * Time.deltaTime);
      }
      }
      paste this in mate, see if it works. i think you might need to change a bit tho

    • @aheavyofculture
      @aheavyofculture 3 года назад +4

      @DRAGO YT GAMING Why do you use a capital at the start of every word?

    • @nutellacheese6017
      @nutellacheese6017 3 года назад

      Lolol

    • @user-ji3tc7ut8k
      @user-ji3tc7ut8k 3 года назад +2

      @@aheavyofculture C# is cap sensitive

    • @aheavyofculture
      @aheavyofculture 3 года назад

      @@user-ji3tc7ut8k so?

  • @taylor_3d
    @taylor_3d Год назад

    That's the gravy! Finally found an answer to the isGrounded issue! Great job!

  • @rasmuus10
    @rasmuus10 4 месяца назад

    This tutorial has helped me so much. Everything works perfectly

  • @fabioeditz8430
    @fabioeditz8430 3 года назад +735

    Me: Copies perfectly
    Unity: 964 ERRORS

    • @aravind.s1187
      @aravind.s1187 3 года назад +9

      LOL

    • @TKTC_The_Key
      @TKTC_The_Key 3 года назад +40

      Only?

    • @fabioeditz8430
      @fabioeditz8430 3 года назад +18

      @@TKTC_The_Key Yea!. Im just good like that.

    • @faynon8765
      @faynon8765 3 года назад +5

      you forget the dot '-'

    • @tfeak2101
      @tfeak2101 3 года назад +33

      don't just blandly copy from it try learn and understand what he is doing so you can apply it again next time, otherwise whats the point.

  • @magicdragon3725
    @magicdragon3725 3 года назад +94

    When you're like, "What's wrong, nothing is showing up" but you forgot to save.

    • @kylu5416
      @kylu5416 3 года назад +4

      Or when you forgot to put a semicolon at the end of a line of code

    • @thespeediestgonzales7704
      @thespeediestgonzales7704 3 года назад

      @@kylu5416 or when you accidentally write code after a semicolon and leave it there in addition to a semicolon at the end

    • @alphaa2182
      @alphaa2182 3 года назад +1

      @@thespeediestgonzales7704 Or when you forgetting the multiplication dash adjacent to the vector

    • @willgamer101dondon7
      @willgamer101dondon7 3 года назад +2

      THAT WAS MY ISSUE THANK YOU SO MUCH

    • @magicdragon3725
      @magicdragon3725 3 года назад

      @@willgamer101dondon7 np

  • @kahuisswag
    @kahuisswag 10 месяцев назад +1

    The video we've all needed at one point

  • @AndyGun11
    @AndyGun11 Год назад +2

    Thank you Brackeys! I just started Unity, and these tutorials are amazing! :DD

    • @McCrazyDude950
      @McCrazyDude950 Год назад +1

      if you finished the code and it worked, quick question: im at 9:40 in the video and im getting a few errors on line 27 (xRotation Mathf.Clamp(xRotation, -90f, 90f); ). when i save the script to unity, it tells me that ; and a , have to be placed some where, and i found where i needed to put it, but it gave even more errors. did line 27 work for you?

    • @McCrazyDude950
      @McCrazyDude950 Год назад +1

      if it did, please tell me what i couldve done wrong

    • @AndyGun11
      @AndyGun11 Год назад +1

      @@McCrazyDude950 uh.. My best advice here is to just restart the tutorial.

  • @xrotator8986
    @xrotator8986 3 года назад +170

    me: *watches the video 5 separate times and remembers something*
    me again : *types it before brackeys says anything about it*
    my brain : I am five universes ahead of you

    • @h.k654
      @h.k654 3 года назад

      Can anyone help me?Whenever I press spacebar the player doesnt do anything.I can move and look around though.

    • @FaruukNN
      @FaruukNN 3 года назад

      @@h.k654 you should check your groundcheck :d

  • @labscience8271
    @labscience8271 2 года назад +709

    Major parts for quick access:
    00:01 - 02:49 Intro & Explanation
    02:50 - 10:40 Camera Movement & Look around
    10:41 - 22:50 Player Movement & Gravity
    22:50 - 23:50 Outro
    Thank you Brackeys
    I miss you :(

    • @Boogaloo69
      @Boogaloo69 2 года назад +11

      Same bro :(

    • @frostblock_12
      @frostblock_12 2 года назад +5

      thanks my dude

    • @MMithy
      @MMithy 2 года назад +4

      @@Boogaloo69 same :(

    • @yourmum69_420
      @yourmum69_420 2 года назад +1

      hey can anyone help me please? When I added controller support my camera spins around like crazy and I don't know why

    • @Bigmanjeff69
      @Bigmanjeff69 2 года назад +1

      Thanks for this bro

  • @MemesChannel7531
    @MemesChannel7531 7 месяцев назад

    The Fact That I Learned 3D Movement Script. YOU ARE JUST AWESOME

  • @arkilusreal
    @arkilusreal Год назад +188

    for whoever needs it, at 10:30, if you are having problems and your mouse is moving very little, go into Main Camera, go on the right side where it says Inspector and go down to the bottom to where it says Mouse Sensitivity and change that to 1000 or how much you are comfortable with. you're welcome

    • @etannn
      @etannn Год назад +2

      Thanks bro

    • @arkilusreal
      @arkilusreal Год назад +1

      @@etannn no probs

    • @DiegoValenciabajista
      @DiegoValenciabajista Год назад +2

      Ey bro, my cursor is still visible even tho I put the Cursor code at the start void. Do you know why?

    • @arkilusreal
      @arkilusreal Год назад

      im so sorry dude i watched this like a month ago so i have no idea lol. But ill try to find out why

    • @DiegoValenciabajista
      @DiegoValenciabajista Год назад

      @@arkilusreal its ok, actually I figure it out. Thank you very much for responding!

  • @sykoo
    @sykoo 4 года назад +558

    That terrain in the thumbnail is 10/10! Thought it was RTX Minecraft, then it started looking like a delicious cake with moss on top of it :P
    Also, welcome back my dude!

  • @maxdukhovskoy1406
    @maxdukhovskoy1406 3 года назад +467

    Me: "ok, I copied this perfectly, it should work..."
    Unity: nah, we don't do that here.

  • @gaurang3586
    @gaurang3586 2 года назад +2

    YOUR ASSETS ARE AWESOME JUST LIKE YOUR
    TUTORIALS

  • @Aragos207
    @Aragos207 Год назад

    Thanks Brackeys, really good explaining everything!

  • @markiyeee
    @markiyeee 4 года назад +414

    me: following every step he makes
    The Word/letter color: is different
    me: there's something wrong I can feel it

    • @mage3690
      @mage3690 4 года назад +11

      Could be the highlight settings. Those have probably changed in the many updates since then. Unless it's not highlighting at all, in which case you or someone has turned them off, or the code straight up doesn't work.

    • @nevetsmahgnirtle8961
      @nevetsmahgnirtle8961 4 года назад +7

      The way I do these tutorials is to watch them a couple of times then enter the script line by line, compiling and running as I go. He has a bewildering habit of backtracking and adding code later on which some may find instructive (not me). I wait 'til the whole script is there then enter each line and test it. Voila! No errors!

    • @Gregory_12
      @Gregory_12 3 года назад +4

      imagine A third-person game, but it's a first-person game

    • @isaacsworld1177
      @isaacsworld1177 3 года назад +1

      😒

    • @oscarfacecamplz8264
      @oscarfacecamplz8264 3 года назад +3

      If it in color. What happens I’m new to Unity please help me it says when I hit play remove the compiler errors.

  • @MathRavn
    @MathRavn 3 года назад +247

    This is the most relatable comment section I've ever seen

    • @akki3535
      @akki3535 3 года назад +2

      I agree lol

    • @oakamaam
      @oakamaam 3 года назад

      reletable :0

    • @MathRavn
      @MathRavn 3 года назад

      @@oakamaam ?

    • @bumewsa1483
      @bumewsa1483 3 года назад

      BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM BUM

    • @foshe
      @foshe 3 года назад

      Hi hi, im no

  • @luketabois2620
    @luketabois2620 2 года назад

    so glad they left all their videos up the gravity code helped me out big time

  • @kapex6405
    @kapex6405 Год назад +359

    Mmovement:
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    public class PlayerMovement : MonoBehaviour
    {
    public CharacterController controller;
    public float speed = 12f;
    public float gravity = -9.81f;
    public float jump = 1f;
    public Transform groundCheck;
    public float groundDistance = 0.4f;
    public LayerMask groundMask;
    Vector3 velocity;
    bool isGrounded;
    // Update is called once per frame
    void Update()
    {
    isGrounded = Physics.CheckSphere(groundCheck.position, groundDistance, groundMask);
    if(isGrounded && velocity.y < 0)
    {
    velocity.y = -2f;
    }
    float x = Input.GetAxis("Horizontal");
    float z = Input.GetAxis("Vertical");
    Vector3 move = transform.right * x + transform.forward * z;
    controller.Move(move * speed * Time.deltaTime);
    if(Input.GetButtonDown("Jump") && isGrounded)
    {
    velocity.y = Mathf.Sqrt(jump * -2f * gravity);
    }
    velocity.y += gravity * Time.deltaTime;
    controller.Move(velocity * Time.deltaTime);
    }
    }
    Mouse Look:
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    public class MouseLook : MonoBehaviour
    {
    public float mouseSensitivity = 100f;
    public Transform playerBody;
    float xRotation = 0f;
    // Start is called before the first frame update
    void Start()
    {
    Cursor.lockState = CursorLockMode.Locked;
    }
    // Update is called once per frame
    void Update()
    {
    float MouseX = Input.GetAxis("Mouse X") * mouseSensitivity * Time.deltaTime;
    float MouseY = Input.GetAxis("Mouse Y") * mouseSensitivity * Time.deltaTime;
    xRotation -= MouseY;
    xRotation = Mathf.Clamp(xRotation, -90f, 90f);
    transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f);
    playerBody.Rotate(Vector3.up * MouseX);
    }
    }

    • @Romaniareps138
      @Romaniareps138 Год назад +21

      legend

    • @Romaniareps138
      @Romaniareps138 Год назад +13

      @Trupnup [GD] some heroes don't wear capes

    • @Pepagg8
      @Pepagg8 Год назад +2

      this script makes the entire character look down not just the camera thus moving the groundcheck so you cant jump when looking down

    • @Romaniareps138
      @Romaniareps138 Год назад +1

      @@Pepagg8 not important

    • @volk4342
      @volk4342 Год назад +18

      If you wanna learn don’t copy this

  • @alariccollado3236
    @alariccollado3236 2 года назад +62

    If anyone is having issues with the line involving "MathF", its "Mathf" now. Hope this helps!

    • @alexbrooks128
      @alexbrooks128 2 года назад +12

      @nostalgia television just tryna help bro chill

    • @cakedon
      @cakedon 2 года назад +5

      That one Unity programmer that changed MathF to Mathf and earned 1000$ for it

    • @psytf2
      @psytf2 2 года назад

      @nostalgia television sounds like you're trying to sound smart

  • @susseratal
    @susseratal 4 года назад +207

    7:26 I love how you can learn how to not tie framerates to game speed in the first tutorial on indie development, but Bethesda couldn't do that in their fully priced, AAA title

    • @Lumiobyte
      @Lumiobyte 4 года назад +6

      @@speedyturtle1537 why are you spamming that everywhere

    • @user-un5xj1wl6p
      @user-un5xj1wl6p 4 года назад +9

      Idk... they have much bigger problems... like they aren't even using an engine comparable to unity... it's more comparable to quake ...

    • @jamieboer3466
      @jamieboer3466 4 года назад +1

      Its much different in Unity vs other engines, plus for larger games they generally have to create their own solutions for this anyway as a lot of unity's solutions are not perfect.

    • @user-un5xj1wl6p
      @user-un5xj1wl6p 4 года назад +1

      @@jamieboer3466 yeah no solution is perfect... but bethesda's cration engine is... an artefact... their previous gamebryo was so-sk back then... but gamebryo is not aimed at modern AAA

    • @Lmao-ke9lq
      @Lmao-ke9lq Год назад +2

      the most funny thing is, that by multiplying mouseX/Y by Time.DeltaTime actually makes sensitivity frame rate dependent, because its already done by default, so this video is wrong, you can test it by setting framerate to 10 fps and then to 1000 fps and see that sensitivy is different if you multiple by Time.DeltaTime, remove it

  • @klaus-wd6en
    @klaus-wd6en 2 года назад

    Brackeys you are the best game dev ever cuz u teach it to us. I am inspired by you and wanna make a game which everyone can enjoy:D

  • @ThunderPlayStudios
    @ThunderPlayStudios Год назад

    in love with your tutorials man

  • @viola_case
    @viola_case 2 года назад +76

    Brackeys tutorials will always be my go-to because his smile makes me feel welcome and ready to learn.

    • @josephjohn9215
      @josephjohn9215 2 года назад

      my camera is not rotating instead player is moving in the x axis when i move the mouse, what do i do

    • @viola_case
      @viola_case 2 года назад

      @@josephjohn9215 I think you meant to put this in the main video thread? I don't know how to fix your problem.

    • @josephjohn9215
      @josephjohn9215 2 года назад

      @@viola_case thank you, but someone else helped me

    • @Couldbeme
      @Couldbeme 2 года назад

      @@josephjohn9215 what'd they say

    • @josephjohn9215
      @josephjohn9215 2 года назад

      @@Couldbeme I didn't put the main camera in the playerlookscript in the inspector so it moved the player instead of the camera
      ( I think )

  • @paynesmells
    @paynesmells 3 года назад +443

    Me: Movement doesn't work.
    Me: Looks for the error in the script.
    My Brain: Everything is correct!
    Me: Sees that the script isn't even enabled.

    • @frindjinny6
      @frindjinny6 3 года назад +10

      where do i pu tthe comma it wants me to put a comma WHERE IS IT AAAAAAAAAA

    • @snoutgames4940
      @snoutgames4940 3 года назад

      i've done that so much lol

    • @TinyDeskEngineer
      @TinyDeskEngineer 3 года назад

      Meanwhile I'm not even using a version of Unity which supports the input system used in the video.
      And the video on the new input system seems to be outdated as well.

    • @oFox_
      @oFox_ 3 года назад +4

      ctrl s am i joke to you

    • @thewindowgames2610
      @thewindowgames2610 3 года назад +2

      Dang, I hate when that happens

  • @DanyVeilleux
    @DanyVeilleux Год назад

    thanks brackeys you're the best for showing us that. seriously thank you

  • @kingkodo7184
    @kingkodo7184 4 года назад +476

    Decent tutorial to get beginners started in the right direction. However, there are at least 2 things i think you should have addressed!
    1.) Trying to jump onto something can cause a stutter/jitter effect because the slope limit(it should be adjusted when you jump and then readjusted when you land)
    and
    2.) If an object is above the character when they jump, the character will still jump and continue to move against the object.(This would have been a good time to introduce collision flags)
    EDIT: Also, the movement vector isn't normalized, resulting in an increased speed if moving at a diagonal angle.

    • @Brackeys
      @Brackeys  4 года назад +171

      Definitely agree that these additions would make the character controller even more solid! I didn't encounter these problems in my test scene but I can of course see cases where this would be good to add :-) Thanks for pointing this out so that people can add this to their scripts!

    • @tamaskisely9122
      @tamaskisely9122 4 года назад +27

      Could somebody please be more specific? ( I mean explain this in a more detailed way) Thanks

    • @equation1321
      @equation1321 4 года назад +4

      Hello

    • @llakuawyus7326
      @llakuawyus7326 4 года назад +6

      @@tamaskisely9122 Yeah a bit more detail would help a lot lol.

    • @TheCivildecay
      @TheCivildecay 4 года назад +13

      How do you normalize the movement so it takes in diagonal movement? If I just normalize the move vector3 it will cause my movement to act slidy (player still moves a bit when releasing the movement buttons)

  • @RichWilx
    @RichWilx 3 года назад +38

    Good tut! The physics stuff is cool and it's interesting to see how "real" physics isn't quite what we expect in games.

  • @mjdragon13
    @mjdragon13 Год назад +6

    For those who dont seem to have the jump or the collider logic working...
    Try using this logic for the ground check...
    // Ground Check Logic
    isGrounded = Physics.CheckSphere(groundCheck.position, groundDistance, groundMask.value);
    if(isGrounded && velocity.y < 0)
    {
    velocity.y = 0f;
    }
    The only change here is the addition of .value to the groundmask param in Checksphere...it did the trick for me 😊

    • @jmdbeans
      @jmdbeans Год назад +1

      sorry it didnt work for me

  • @sofiaonaga5352
    @sofiaonaga5352 Год назад +1

    I optomized it for the new input system and it works great!

  • @raffe7889
    @raffe7889 3 года назад +214

    I can't believe Brackeys is gone ;_; Their content is still amazing though and they made A LOT of it

  • @georgebooth6441
    @georgebooth6441 3 года назад +227

    Me: Gravity doesn't work.
    Me: "Alright I'll continue in about 3 years,"

    • @tinsku332Xd
      @tinsku332Xd 3 года назад +1

      @Torben Kauth it worked for me

    • @jayjayjay-er9ex
      @jayjayjay-er9ex 3 года назад

      @@tinsku332Xd i can't get it to work. whenever i jump it doesn't work and turns off the gravity. any tips or code i could use?

    • @tinsku332Xd
      @tinsku332Xd 3 года назад +7

      @@jayjayjay-er9ex this should work
      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      public class PlayerMovement : MonoBehaviour
      {

      public CharacterController controller;
      public float speed = 12f;
      public float gravity = -9.81f;
      public float jumpHeight = 3f;
      public Transform groundCheck;
      public float groundDistance = 0.4f;
      public LayerMask groundMask;

      Vector3 velocity;
      bool isGrounded;
      // Update is called once per frame
      void Update()
      {
      isGrounded = Physics.CheckSphere(groundCheck.position, groundDistance, groundMask);

      if(isGrounded && velocity.y < 0)
      {
      velocity.y = -2f;
      }
      float x = Input.GetAxis("Horizontal");
      float z = Input.GetAxis("Vertical");

      Vector3 move = transform.right * x + transform.forward * z;

      controller.Move(move * speed * Time.deltaTime);

      if(Input.GetButtonDown("Jump") && isGrounded)
      {
      velocity.y = Mathf.Sqrt(jumpHeight * -2f * gravity);
      }
      velocity.y += gravity *Time.deltaTime;

      controller.Move(velocity * Time.deltaTime);

      }
      }

    • @jayjayjay-er9ex
      @jayjayjay-er9ex 3 года назад

      @@tinsku332Xd thank you sososososososososo much

    • @jayjayjay-er9ex
      @jayjayjay-er9ex 3 года назад

      @@tinsku332Xd i copied and pasted your code but no luck. same as before :(

  • @Whopper3
    @Whopper3 2 года назад

    Thank you so much. This helps me fine a starting point and commit to making a game

  • @usamabinmuzaffar692
    @usamabinmuzaffar692 2 года назад +33

    A problem that I was facing was that when I implemented the player movement script, the camera would start moving independendantly of it's parent object named "First Person Player". The reason I found for this is that in the 2020.3 and above versions of unity, the "Main Camera" comes with a script called "Simple Camera Controller (Script)". This makes the camera move within the game. You need to disable it for the camera to move with the parent object.
    Edit: I found out that the problem I mentioned above only happens in URP. So if your project is not on that then you shouldn't have this problem

    • @shadow501pl
      @shadow501pl 2 года назад

      its only in the universal render pipeline

    • @usamabinmuzaffar692
      @usamabinmuzaffar692 2 года назад

      @@shadow501pl yeah you're right. I made the same project in HDRP and this wasn't there. I'll update my comment

    • @paulaoag
      @paulaoag 2 года назад

      Ok, but how i can disable that script?

    • @usamabinmuzaffar692
      @usamabinmuzaffar692 2 года назад

      @@paulaoag right click on the scrip and remove the component.

    • @GlitchGBG
      @GlitchGBG Год назад +2

      i dont see the component so i cant delete it
      ):

  • @MidasClutch
    @MidasClutch 3 года назад +151

    Me- follows instructions carefully and does everything he says
    Unity- 1 error: please delete unused term “mouseY
    Me- removes mouseY
    Unity- 1 error: please add “mouseY
    Me- *dies*

    • @holliscf
      @holliscf 3 года назад +5

      Space in btw mouse and Y?

    • @learnenglishinhouse3102
      @learnenglishinhouse3102 3 года назад +5

      error because the space, is "Mouse Y"

    • @sohamacharya171
      @sohamacharya171 2 года назад +2

      A catch 22 situation.

    • @fillament
      @fillament 2 года назад +2

      That happens too much.

    • @sylinder__2633
      @sylinder__2633 2 года назад +1

      personally it says i have to setup mouse x but i dont know how to do it

  • @bigusdickus7866
    @bigusdickus7866 3 года назад +119

    Me: sees different colours in the script on my screen than his screen
    Also me:I recon this ain't workin

    • @Charduza
      @Charduza 3 года назад +3

      lol different colors dont matter

    • @bigusdickus7866
      @bigusdickus7866 3 года назад +3

      @@Charduza I am boomer, I feel embrassed

    • @jacobmars1902
      @jacobmars1902 3 года назад +6

      @@bigusdickus7866 I used to think that as well, don’t worry

    • @tryfle3461
      @tryfle3461 3 года назад +2

      For some reason it won't let me code do you know why that is? Do I have to download something other than unity?

    • @jacobmars1902
      @jacobmars1902 3 года назад +1

      @@tryfle3461 download the unity tools package for your IDE

  • @pringl3
    @pringl3 5 месяцев назад

    YESSS TYSM FOR THIS, my one finally worked after try about 5 other tutorials

  • @kabirshingh7521
    @kabirshingh7521 Год назад +2

    Thanks so much, sir! It helped me a lot in learning Unity I am a beginner so it is helpful for me and easy to understand BTW new sub 😃

  • @LegndGames_YT
    @LegndGames_YT 4 года назад +237

    Great tutorial as always! I might be wrong, but I think you are making a misstake by applying delta time to the mouse input. The reason for this is that the mouse input you are receiving is already a delta value.. It is already the amount you have moved that frame!
    The mouse is an asynchronous input device. So it's position value already changes over time, not per frame!
    Upvote for awareness :) Also if I'm wrong with any of my claims, please let me know for my own educational purpose.
    Peace!

    • @pepijnvb1484
      @pepijnvb1484 4 года назад +16

      Thanks for the tip, it removed the stuttering for me!

    • @LegndGames_YT
      @LegndGames_YT 4 года назад +1

      @@pepijnvb1484 No problem! Glad to help :)

    • @karter6632
      @karter6632 4 года назад +2

      @@LegndGames_YT how do i do this

    • @karter6632
      @karter6632 4 года назад +3

      @@LegndGames_YT how do i do this

    • @LegndGames_YT
      @LegndGames_YT 4 года назад +4

      @@karter6632 Simply remove Time.deltaTime from the MouseLook script :)

  • @tres-2b299
    @tres-2b299 2 года назад +9

    I used this tutorial just to know how to rotate and actually make the player move, i have all the new input system stuff already with mobile joystick, and it worked!

  • @killeroblivin
    @killeroblivin 15 дней назад

    Im glad i found this video so i could yoink your grounded detection

  • @JakeB0079
    @JakeB0079 Год назад

    This is the first camera rotation script ive seen work ive sifted thru script and youtube vids for hours for this. hopefully the player movement is as easy!

  • @nicolaicardinale7902
    @nicolaicardinale7902 2 года назад +24

    It's 2021 and this video is still a GODSEND. thank you so much for not just good instructions but clear ones.

  • @boysminecraftianos469
    @boysminecraftianos469 4 года назад +234

    Me yesterday: Well, I'm gonna take part of a GameJam from my programming school, so I think I'll do a 3D First-Person Survival Game. *And I want to do as much as possible alone, not copying code or getting stuff from the internet*
    Me after taking a look at this video: The hell are quaternions?
    Me after searching about it: I'd better copy some code

    • @talibalasrar
      @talibalasrar 4 года назад +12

      Everyone copies code at first you will learn gradually over time

    • @davidfails2866
      @davidfails2866 4 года назад +2

      Haha... Explain them to me im too lazy to look them up

    • @linshu6141
      @linshu6141 4 года назад +1

      Most of the time u will copy code anyway. Just putting it together and make a final and unique game out of it is the difficult part. Of course u will learn over time the basics that u often use but i promise you u can't learn everything.

    • @itzyuzuruclips
      @itzyuzuruclips 4 года назад

      lol I'm working on a game with my grp and I'm at the same stuff 😂😂
      Now imma copy some movements and aim codes

    • @icantthinkofaname2722
      @icantthinkofaname2722 4 года назад +1

      You don't need to know how Quaternions work to utilise their implementation. Tbh you wouldn't even need to know how they work to implement them yourself (even if it would certainly be helpful).

  • @Cold_soup._.
    @Cold_soup._. Год назад

    This genuinely helped so much fr

  • @napoleon384
    @napoleon384 2 года назад +4

    man i always wanted to make games and u are best teacher that i could've asked for, everything is detailed and easy to understand. i always thought that gamedev was hard but then i found u. thank a lot

  • @Semmetje11lolly
    @Semmetje11lolly 3 года назад +53

    2:49 video starts here (for myself, because I'll be coming back here A LOT)

    • @thunderbear06playsstuff63
      @thunderbear06playsstuff63 3 года назад +1

      Well you could export the player as a package so that you can import it into more projects in the future

    • @thunderbear06playsstuff63
      @thunderbear06playsstuff63 3 года назад

      thats what im trying to do rn

    • @matthewsimpson796
      @matthewsimpson796 3 года назад

      Thanks?

    • @timmy21r
      @timmy21r 3 года назад

      @@thunderbear06playsstuff63 How do you do that?

    • @thunderbear06playsstuff63
      @thunderbear06playsstuff63 3 года назад

      @@timmy21r This should be what your looking for docs.unity3d.com/Manual/AssetPackagesCreate.html hope that helps

  • @bagger1451
    @bagger1451 2 года назад +204

    Me: Copys his code perfectly
    Unity: 341 Errors
    Me: Adds 1 letter
    Unity: Perfect.

    • @lcj3_
      @lcj3_ 2 года назад +10

      fax man
      me: **Forgets to put a semicolon**
      Unity: This semicolon will ruin your life now.

    • @Ikaros-fo5cb
      @Ikaros-fo5cb 2 года назад +4

      for some reason the script for the mouselook doesn't work on my "game" what do i do?

    • @FelineRaptor-gv4te
      @FelineRaptor-gv4te 2 года назад

      @@lcj3_ but your IDE will point out where you missed the semi colon

    • @lcj3_
      @lcj3_ 2 года назад +1

      @@FelineRaptor-gv4te i accidentally wrote an # in the middle of the code without even realizing and it took me 2 hours to find me that p.........

    • @lcj3_
      @lcj3_ 2 года назад

      @@FelineRaptor-gv4te unity didn't even tell me where the error of the code was, it was pointing to something that i wrote correctly, when i removed the #, everything worked perfectly

  • @nofch247
    @nofch247 Год назад +6

    Your a life saver thank you so much for all the help you are putting in for my game

  • @Blue_Fox_Plays
    @Blue_Fox_Plays Год назад

    Thank you so much for this tutorial! it helped me a lot!

  • @no8053
    @no8053 3 года назад +15

    One of the most satisfying parts about coding is when you successfully debug something eventhough it was just a small error like forgetting one cast or something

  • @bobsapdagger
    @bobsapdagger 3 года назад +63

    Gotta say there's nothing quite as satisfying as successfully debugging; it's a mountain of negativity instantly lifted, no more errors, no more red squiggly lines, no more self doubt you don't even care that it was something really stupid, it still feels good.

    • @eeevoo
      @eeevoo 3 года назад +3

      couldn't have said it better

    • @marcusaddison8866
      @marcusaddison8866 3 года назад

      Out ranks all those satisfying video compilations on RUclips

    • @h.k654
      @h.k654 3 года назад

      Can anyone help me? I have a problem where I cant jump even though I copied the exact code.

    • @eeevoo
      @eeevoo 3 года назад

      @@h.k654 Did you assign the script to the player?

    • @h.k654
      @h.k654 3 года назад

      ​@@eeevoo Yes.

  • @cesar3rocks783
    @cesar3rocks783 2 года назад

    I used it for a 3º person game and it works just fine the only thing I changed was the camera but the rest of the movement worked smoothly, thanks so much, this helped a lot

    • @fobman8778
      @fobman8778 2 года назад

      must've been cold

    • @cesar3rocks783
      @cesar3rocks783 2 года назад

      @@fobman8778 what do you mean?

    • @fobman8778
      @fobman8778 2 года назад

      @@cesar3rocks783 u wrote it like 3 degrees

    • @cesar3rocks783
      @cesar3rocks783 2 года назад

      @@fobman8778 ooooo now I get it

    • @fobman8778
      @fobman8778 2 года назад

      @@cesar3rocks783 hahaha

  • @Super_Nova919
    @Super_Nova919 Год назад +2

    This Helped me so much, you deserve a subscribe :)

  • @zimistic6680
    @zimistic6680 3 года назад +438

    “Man coding is so easy and works every time!”
    -nobody on planet earth

    • @jacobjackson8619
      @jacobjackson8619 3 года назад +20

      if i hear anyone say this, i smack their face with the errors i got in the last 5 mins

    • @doge7831
      @doge7831 3 года назад +10

      I got 999+ errors in 5 minutes of coding.

    • @noamyairperelman875
      @noamyairperelman875 3 года назад

      @@doge7831 me to

    • @ruddydd4085
      @ruddydd4085 3 года назад

      truth :p

    • @lightbulb8888
      @lightbulb8888 3 года назад +2

      its actually ez and i didn't get any erro

  • @elvisdeleon6709
    @elvisdeleon6709 2 года назад +5

    Concise tutorial! Great for experts and beginners!

  • @Enderia2
    @Enderia2 Год назад

    I love how the second result for 1st person movement unity is a video which doesn’t work when recreating it exactly 7 months ago, and this is from 2 years ago, simple, and works.

  • @joeyestrada9071
    @joeyestrada9071 5 месяцев назад

    You're literally the best at showing us this stuff. It's a shame you don't make videos anymore...

  • @BishalKhan01
    @BishalKhan01 4 года назад +23

    BROOOOOOOOOOOOOOOOOOOOOOOOOOOOOO, I was sooooo hoping for a tutorial on how to make First Person Movement in Unity and am soooo glad that Brackeys made this video.
    Brackeys is the BEST!!!

    • @speedyturtle1537
      @speedyturtle1537 4 года назад

      It would be great to have you on the team!! discord.gg/KpHx7Fj

  • @TheAmazingPyro99
    @TheAmazingPyro99 3 года назад +746

    me: copys all of the code perfectly
    unity: ERROR
    also me: changes from a capitalised T to an normal t
    Unity: no errors

    • @superlative_
      @superlative_ 3 года назад +49

      let me guess. transform and Transform?

    • @jangamer2971
      @jangamer2971 3 года назад +22

      Lmao I was seraching for answers in comments to help me you were the one I just replaced the T with a t

    • @TheAmazingPyro99
      @TheAmazingPyro99 3 года назад +8

      @@jangamer2971 bruh

    • @Larss_J
      @Larss_J 3 года назад +4

      I have the same problem

    • @Yoctopory
      @Yoctopory 3 года назад +16

      So in fact you DIDN'T copy the code perfectly ;)

  • @gregorvalusso629
    @gregorvalusso629 Год назад

    You helped me a lot. Thanks so much!

  • @shadowboi1812
    @shadowboi1812 Год назад +5

    instead of setting y and z of camera to 0, you want to set it to transform.rotation.y and transform.rotation.z in case you want to add anything that changes camera angles in the future

    • @Arctic.Wolves
      @Arctic.Wolves 9 месяцев назад +1

      thanks for advise, always met this in the code, but never realized what actually it is do. cheers :)

  • @jacobfenech7662
    @jacobfenech7662 4 года назад +356

    My brain when I am a 13 year old boy and just started programming: Just copy everything and it'll work. You don't have to understand the code.
    (2 seconds later) Unity: You have to fix compiled errors.
    Me: Time for new project.

    • @salemisjuucy
      @salemisjuucy 4 года назад +23

      I'm thirteen and it's pretty simple, make sure your line of code is in between an opening and closing bracket, make sure there are no spelling errors, and maybe just learn the basics of c# like i did

    • @Just_Cat.
      @Just_Cat. 4 года назад +1

      same

    • @InsaneJumpscare
      @InsaneJumpscare 4 года назад +1

      @@salemisjuucy compiled errors

    • @NielsKnives
      @NielsKnives 4 года назад +5

      I m 12 and i get it

    • @InsaneJumpscare
      @InsaneJumpscare 4 года назад +1

      N M video's but it still has errors, am I using the wrong coding app? I am using c# visual studio

  • @imaUFO672
    @imaUFO672 4 года назад +6

    Just when i needed a tutorial like this, you’re a life saver!

    • @andrews4208
      @andrews4208 4 года назад

      i cant place closed brackets, how did you do it

  • @zeusexmachina3991
    @zeusexmachina3991 11 месяцев назад

    After painful hours of looking for the problem, I figured I arranged the functions in the wrong way. Guys, always be sure you put them in the logical way.

  • @scrumpieTF2
    @scrumpieTF2 3 месяца назад

    The most helpful tutorial out there

  • @Ultra7896
    @Ultra7896 2 года назад +8

    This really helped me start 3d game development!

  • @lynxlagoon
    @lynxlagoon 4 года назад +17

    exactly!
    i was trying to get into unity by making a simple (or so i though) character controller
    turns out it was one of the hardest things to do

    • @MuttleyGames
      @MuttleyGames 4 года назад +3

      Don't worry.It gets harder :D
      Remember Forums and documentation are your best friends and you most likely will need to merge solutions together.
      Straight forward stuff in Unity will not work and need work arounds so be prepare to troubleshoot.
      You can make as complex as games as you wish but you need to get your hands dirty.

    • @lynxlagoon
      @lynxlagoon 4 года назад +1

      @@MuttleyGames When i tried it, i could make the character move, and the camera "turn" (you know what i mean)
      but i couldn't merge them together so that if the camera turned right, the character turns right

    • @MuttleyGames
      @MuttleyGames 4 года назад

      For a camera just learn to use Cinemachine.There is 0 point of using the original one.
      I've made my own code and i've used people scripts...its buggy and clips trough walls.
      Watch a good Cinemachine tutorial and you will save time and effort.

    • @lynxlagoon
      @lynxlagoon 4 года назад

      @@MuttleyGames Cinemachine? From looking at the pictures a few months ago i thought it was only for cinematics or cut scenes

    • @MuttleyGames
      @MuttleyGames 4 года назад

      @@lynxlagoon You can use it for that but it's a free camera you can set up in a game and it has everything you would want from a camera in terms of options and flexibility.. No coding required.

  • @odysseaskorelides7897
    @odysseaskorelides7897 5 месяцев назад

    i really adore your effort to teach us...

  • @aljabarysam
    @aljabarysam Год назад

    Thanks so much! I subscibed just to how informative this is!

    • @Gray-
      @Gray- Год назад

      he quitted yt, but he has a discord, you can get help there

  • @redspartan7772
    @redspartan7772 2 года назад +71

    There’s nothing better than that feeling when you complete some code and get no errors

    • @shard7572
      @shard7572 2 года назад +3

      Ah, yes that feeling when the stars align

    • @mrgibus8278
      @mrgibus8278 2 года назад +5

      Sadly, for me that is a feeling I have yet to expirience

    • @goodgamershow6505
      @goodgamershow6505 2 года назад +5

      it's all cool and etc, but have you ever finally piss, after not being able to do it for several hours straight?

    • @sohamacharya171
      @sohamacharya171 2 года назад +1

      A worse thing is when you have no errors but it still doesn't work.

    • @ionutdaniel4059
      @ionutdaniel4059 2 года назад +1

      I got no errors
      *Starts the game and tries to move camera*
      unity: best i can do is spin