#1 FPS Movement: Let's Make a First Person Game in Unity!

Поделиться
HTML-код
  • Опубликовано: 27 апр 2024
  • The first video in a series where we are creating a First Person game!
    In this video we look at setting up our characters movement.
    I've setup a Discord!!! and I would love to have you help me start up a friendly community where we can all help each other grow as game developers!
    Discord invite link:
    / discord
    Can't wait to see you there !
    💚 Thanks for watching!
    0:00 Introduction
    0:36 Player Setup
    1:18 Import Input System
    2:13 Movement & Jump Actions
    7:22 Input Manager [Code]
    9:04 Movement [Code]
    11:54 Input Debugger
    12:57 Adding Gravity [Code]
    14:55 Jumping [Code]
    16:54 Player Look Actions
    17:35 Player Look [Code]
    20:52 Result!

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

  • @NattyGameDev
    @NattyGameDev  2 года назад +1399

    Hey everyone!!
    I have recently discovered that 2D vector composite has been changed slightly in later versions of Unity
    In this tutorial I am using 2020.3.8f1..
    In order to do the same thing.. you will need to change some of the properties of the Movement action...
    So with the Movement action Selected:
    - In the the Properties tab
    - Change the 'Action Type' to Value
    - Change the 'Control Type' to Vector 2
    Now you will be able to right click on the Movement action and Add an Up/Down/Left/Right Composite!
    Hope this helps! 😃
    Also I left it out of the video but if anyone is having trouble implementing crouch and sprint, you need to define some extra properties for these at the top of your PlayerMotor script
    lerpCrouch, crouching, sprinting -> bool
    crouchTimer -> float

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

      hello there man can u continue the series pls or atleast make a tutorial on how to get such good graphics like post proccesing and stuff cs everytime i create a new project the project has such bad graphics

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

      Hey i know your busy but I need some help really bad when you dragged the camera on to the player look script it had a place for it mine doesn't do you know what I could of done wroung

    • @NattyGameDev
      @NattyGameDev  2 года назад +6

      @@gamertagyyshsggege1787 so the only line that will relate to being able to do that is public Camera cam;. So what I would recommend is make sure that it is public :). If there are any compiler errors before you saved the script then it will cause unity to not actually update the inspector, so maybe that could be causing the property to not show up... :). Alternatively if you want to do everything through code. You don't need a public Camera and you can use Camera.main to find the camera with the tag "MainCamera".. then you won't need the "cam" property... I will be setting up a discord soon to provide more reliable help if you would like to join then feel free to send me an email (which is in my channel page) and I will send an invite :)

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

      @@andubunea9627 I am definitely keeping this series going and I will be covering post processing in order to make you game look awesome!! Apologies for the delay in getting the next one uploaded. It will be up in the next few weeks ! :D Thanks for watching!

    • @gamertagyyshsggege1787
      @gamertagyyshsggege1787 2 года назад +6

      @@NattyGameDev Hey I fixed it up and now it works I would like to say thank you for your response I wasn't expecting you to lol

  • @eminkilicaslan8945
    @eminkilicaslan8945 Год назад +604

    For those who couldn't find 2D vector binding: you have to select your action (Movement) and change action type to value and control type to Vector 2.
    Edit: This is briefly same as in pinned comment

  • @JasonSmith-pn6ch
    @JasonSmith-pn6ch Год назад +20

    FYI: moving Jump from LateUpdate and Move from FixedUpdate to Update fixes stutters. Fixed and LateUpdate have moments of pauses, miliseconds but still induces stuttering on fast movements like turning your player.
    Just came across your tutorial, helped a ton. So many ways to go about setting up basic movement with the InputSystem, this seemed to make the most sense to me and actually able to understand what and why. Thank You!

  • @zakstrazdas9221
    @zakstrazdas9221 Год назад +10

    Great tutorial man! Managed to go though it all and done my own troubleshooting as I'm currently running 2021.3.13f1 version, some of the things changed here and there but in the end I got a fully functional FPS movement.
    Thank you

  • @abel099
    @abel099 Год назад +312

    if you want to implement crouching and sprinting don't forget to add a:
    bool crouching = false;
    float crouchTimer = 1;
    bool lerpCrouch = false;
    bool sprinting = false;
    do this in the playermotor script next to the other floats and bools (at the top of the script)

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

      thanks 😃

    • @jaceleeanderson
      @jaceleeanderson Год назад +12

      I was able to implement crouch and sprint successfully, however pressing down on the left game pad stick activates a sprint and deactivates when I press it again. Is there a way to sprint only while the left game pad stick is pressed?

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

      Thanks dude

    • @willysmb-bo2vn
      @willysmb-bo2vn Год назад +10

      @@jaceleeanderson When you go to the screen where you set up your controls you click on your control (sprint/crouch) and on the right side there is "Action type" which you set to pass through. Then there appears another field right under the last where you choose button.

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

      Thank's it help a lot

  • @lapurplemando5837
    @lapurplemando5837 2 года назад +26

    Thank you so much for this tutorial! I had never used Unity to make anything before but this tutorial was very easy to understand, and I can’t wait for part 2!

  • @Islati
    @Islati 7 месяцев назад +64

    It would be nice if you can explain the classes, methods, and API's you're using, why you're doing it, and a higher level understanding. I get it cause I've been doing this for a long time, and it's fairly straightforward, but it's a bit quick from a viewer perspective.

    • @MrMelon-gs6bq
      @MrMelon-gs6bq 7 месяцев назад +8

      Idek what's happening I'm just copying what he does

    • @Islati
      @Islati 7 месяцев назад +22

      @@MrMelon-gs6bqthat’s the issue. You’re not learning much through imitation here

    • @realpotatogaming
      @realpotatogaming 6 месяцев назад

      but the game is cool tho@@Islati

    • @Gigapally
      @Gigapally 5 месяцев назад +4

      Can confirm this yea, i came here for a basic tutorial to learn and hes breezing through C# scripts in minutes.

    • @dominicd.1286
      @dominicd.1286 5 месяцев назад +3

      Yeah, this tutorial is useful, but it's definitely not for beginners. He goes way too fast and its hard to follow along. I wish everything was explained so I can understand what the code is doing

  • @monkeywrenchsoft8531
    @monkeywrenchsoft8531 Год назад +145

    If you want to toggle sprinting:
    -Go to your Input Actions
    -Go to the Sprint action map
    -Add a "Press" type Interaction
    -Make the trigger behavior "press and release"

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

      What version were you using?

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

      @@kingd0ofus 2021.3.12f1

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

      thank you so much bro

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

      Thanks man, helped

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

      Thank you so much, i fixed the crouch as well, and fixed the jump not working properly by adding "Press" type interaction and make the trigger behaviour to "press".

  • @rustyrishii
    @rustyrishii 2 года назад +9

    hey man @Natty Creations , this tutorial is amazing! I hope you continue this series! loved it!

  • @MelatoninMadness
    @MelatoninMadness 2 года назад +7

    So excited to follow an up to date tutorial series

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

    This is fantastic! I hope you'll continue the series!

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

    Thank you so much for this tutorial, I was stuck on first person character control, no other tutorial helped me, and now I know how to use the new input system for other ideas!

  • @NattyGameDev
    @NattyGameDev  2 года назад +95

    Thanks for all of the support and kind feedback!!!
    Just to let you all know I am working on getting the next video out!
    There are some more complicated concepts in the next one so I want to make sure they are easy to understand!
    Thanks again! ❤

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

      whe are you going to post it?

    • @half-maskedhero
      @half-maskedhero 2 года назад

      Can I please get some help? I am trying to make my first game and have ran into a promblem. I would be greatly
      appreciated!!!

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

      @Natty Creations
      I'm just starting unity and I don't know any "properties tab" can u post a video or at least post some images thank u :D

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

      Any idea why my button inputs aren't making my character move? All the scripts are matching up, I've watched from the beginning five times or more, but every time I try to make the character move, it doesn't work. I opened the debugger and it's registering my button presses but it's not making anything happen.

    • @zestyranch.
      @zestyranch. Год назад

      I'm using 2021.3.19f1 I don't see any of the movement stuff

  • @bigmik7306
    @bigmik7306 2 года назад +47

    Just getting into game design and learning Unity!
    So glad I found this new tutorial series and cannot wait to get started - looks incredibly informative and professionally done.
    Thank you!

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

      Same! i'm also new to unity and game design.

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

      so did u learn anything after 7 months

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

    I dont know why but even tho Im working on a multiplayer game for steam I still find myself just having your videos playing on the other monitor since your voice is so relaxing

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

    Tysm, i’ve learned a whole bunch of new stuff from this video and the comments helped too whenever there was an error. I was able to make the sprint and the crouch too!

  • @jorikspiritwolves7486
    @jorikspiritwolves7486 2 года назад +19

    I'm very new to any form of programming and have only just finished the create with code pathway. But your instructions are so clear and easy to follow along that I finally can see myself trying to make a full-fledged game one day! :D Thank you so much for making these!!

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

      Really happy to hear people in the same situation understanding it well ! Maybe I have hope after all !
      So how much did you progress since ?

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

      I've been following another tutorial about the basics of voxelworlds and have almost finished that one.
      So unfortunately I haven't build my dream-game yet (also because of a fulltime job and only little time to work steadily on this hobby).
      But I have learned enough of the basics to continue prototyping the main game components :)
      I even made some crude platform 1-level games.
      I do have heavily underestimated the work it can take to make a game and have a LOT more respect for developers than I already had :)

  • @dariusjackson1960
    @dariusjackson1960 Год назад +7

    outstanding video bro. So surprised to see your sub count. whole video was comprehensive and i like how you allowed the viewers to try some new stuff on their own. Im new to coding and i feel like the shit bc i figured out the sprint and crouch lol. I said that to say your method was effective teaching-wise. keep it up

  • @hansuswurstus888
    @hansuswurstus888 8 месяцев назад +5

    Thx for your awesome work :)
    As a developer for myself (non gaming, being a junior for one month, fresh from school :P) I rly like your code structure and that you're coding a lot with data encapsulation, which makes it so much easier for me to understand your code and see the structure behind it.

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

    Great tutorial; loved the highlighted code snippets it was a nice touch.

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

    This serie is gonna be awesome. Thank you!

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

    dude.
    I cannot tell you how much that this video has helped me.
    thanks so much!

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

    duude you helped me lot, i'm trying to not just following this tutorial, but also figure it out to create game myself, and it's working, thank you ❤

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

    Bro you are one of the best tutors of unity I have ever find on RUclips

  • @jay.b843
    @jay.b843 2 года назад +7

    understood about one percent but thats the most ive ever understood from any unity tutorial ever, so good job

  • @selagia
    @selagia 2 года назад +52

    This tutorial was really well made and easy to follow, thanks for making such a video. I’ve been struggling with the new input system and this made it way easier to understand. +1 sub

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

    Nice video. Very easy to understand and follow. Underated RUclipsr for sure

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

    this was so, so helpful, thank you! i had no idea how to make movement and combat in my game!

  • @infinitelol2119
    @infinitelol2119 2 года назад +48

    this is a very underrated tutorial and this series will help many beginner and intermediate game devs out, just wanna let u know, the community appreciates you don't stop, brackeys is proud of you

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

      agreed

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

      Short question. So I followed the tutorial in every single step but when I tested it and press "W" may player actually moved "up" not "forward" do you now why that is?

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

      @@thetinywombat3848 months later but had this issue, check your moveDirection in ProcessMove. It Should be .x = .x and .z =.y

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

    PLEASE CONTINUE THIS I LOVE IT!!! This is the way im going to be doing my movement from now on Thx

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

    Thanks a lot for the tutorial, btw, mad respect for the wallpaper, Outer Wilds is my favorite game ever

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

    Amazing! Clean and concise code. I love it.

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

      if you got the code right can you past it please

  • @mrnobody3122
    @mrnobody3122 Год назад +11

    Hi man, earned yourself a sub. I've been programming for about 6 years nearly half my life but only recently got into gamedev. This tutorial was wonderful and unlike other tutorials, you actually helped in the comments. I wouldn't have even been able to start without the 2d Vector control binding. I can see you doing very well

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

      I don't have the 2D vector Control Binding, any help?

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

      @@missunknowngaming6890 In the OnFoot action map, go to movement, in the action properties change action type from button to value, and then set the control type to vector 2

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

      @@mrnobody3122 THank you!

  • @lobstalord9627
    @lobstalord9627 Год назад +7

    You sir a re a legend, it took me some time and I kept running into errors because my spelling was off but in the end I got everything working. I also visited your discord and within 2 min of asking a question I got an answer and programming help. Keep it up man :)

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

    Just started to learn how to use Unity. I had some basic prior Python and C# knowledge of syntax and how to use the console, but I was reluctant to even open Unity, let alone try and use it. Then you came along and just made it all seem so simple! It was so easy to follow compared to other tutorials, so thank you!

  • @erikbach8436
    @erikbach8436 6 месяцев назад

    i had some problems while doing it but with the help of comments everything works, very happy with ur tutorial m8

  • @terraxanthis82
    @terraxanthis82 2 года назад +30

    The new input system has been so difficult to wrap my head around. Hoping you cover some other basics (doors, buttons, etc.) because there's so few tutorials out there for it! Also, as a side-note, were you planning on going further in-depth on crouching? What you provided was solid, and I've gotten it working well enough, and I THINK I could figure out raycasting to prevent standing up and clipping into objects on my own, but I'm also having the player clip through walls that are low enough to walk under, but still at camera height. Bit weird, and still not sure where to start on that. Either way, looking forward to more!

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

      My next video will cover an interaction system that I think is awesome! Very easy to create heaps of interactions quickly, (it's taking abit longer than I hoped as it's been a very busy few weeks)
      Yeah, you could definitely do it that way,. raycast upwards when you are crouching, and if the raycast detects anything above head height, then just return; so that it doesn't cancel the crouch..
      And for the player clipping through walls would it be possible to do a simple fix of just lowering the camera slightly ?? If not let me know and we can work out another way to fix this :)
      Thank you so much for watching and commenting!

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

      @@NattyGameDev Absolutely! Excited to see what you've got in the next video.

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

      @@NattyGameDev I've kept working away (sort of focused on modeling and environmental stuff, not so much code!) and since I've started building levels with steep slopes and walls, I was wondering if you had a solution for making the player slide down steep slopes? The default character controller only handles what slopes you can walk up, but not making you fall down them-- as a result, you can stand and hop all the way up a nearly-90* angle wall! Any suggestions on that front?

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

      @@terraxanthis82 Have you tried messing around with Physic Materials ??
      With a raycast you could find out the angle of the ground relative to the player, . and if the angle exceeds a certain amount swap out the physics material that has the dynamic friction turned down to 0.

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

      @@NattyGameDev help i am having this errorAssets\Scripts\InputManager.cs(23,43): error CS1061: 'InputAction' does not contain a definition for 'Readvalue' and no accessible extension method 'Readvalue' accepting a first argument of type 'InputAction' could be found (are you missing a using directive or an assembly reference?)
      how to fix it ?

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

    This tutorial was amazing. I have been trying to find a tutorial for a first person game forever and this one worked, Thank you so much! :>

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

    thank you for sharing this with us!!!

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

    Awesome video. Straight to the point.

  • @beatrizalbuquerque8792
    @beatrizalbuquerque8792 11 месяцев назад +49

    For everyone having a camera stutter when sprinting or moving a little bit faster:
    --> go to Edit > project settings > time
    --> set Fixed Timestep to 0.005 (default is 0.2)
    Hope this helps!

    • @dylancolin5045
      @dylancolin5045 11 месяцев назад +1

      thanks

    • @scuba6468
      @scuba6468 11 месяцев назад +1

      thank you!!

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

      still there any other fixes?

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

      @@geoauthentic putting your game scene in full screen reduces stutter as well

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

      thank you so much

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

    I was being annoyed by many errors, but finally made it within 2 days...
    Thanks for the tutorial, I appreciate for that!

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

      can you help me fix this error in the input manager script it seys that PlayerMotor could not be found are you missing a using directive or an assembelly reference

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

      @@Badstplayer same

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

      @@Badstplayer didnu fix it?

  • @reiya3425
    @reiya3425 8 месяцев назад

    Thank you for your awesome instructional video
    it has helped me a lot! :))

  • @0dnc
    @0dnc Год назад

    You are the best one I guess. Definitely love your videos, thank u so much for spending ur time

  • @RoninDoesStuff
    @RoninDoesStuff 2 года назад +50

    Brackeys for a long time has been the gold standard for a lot of us aspiring gamedevs, as far as tutorials go. However, now that most of his content has been outdated, the assets used within those tutorials are broken, and the amount of scouring comments to find a fix for a litany of problems introduced from the previous 2 problems, it's no longer useful.
    After doing some digging, I found this video and cannot express how relieved I am. Now that i have a proper working controller script, I'm going to play with it and learn what I can before moving on to your next video; btw I particularly loved the "homework" at the end of the video.
    As long as you keep these videos up to date (which btw, thank you for pinning the fix comment below about 2d vectors), I see no reason why you won't be the next unity guru on youtube! If you ever develop this course professionally on skillshare or something, let me know. I'd love to dive deeper, with longer videos explaining the code in detail and how it functions in relation to the assets.
    Keep up the great work!

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

      Thanks so much for those kind words! I'm so glad this video has helped you! I try very hard to make sure my videos are easy to follow and well designed so that everyone can be proud of their end product, and I'm still shocked that there's been such a positive response! It was a sad day when Brackeys stopped doing tutorials :(

  • @blz_Omega_Orion
    @blz_Omega_Orion 9 месяцев назад

    I love this! Thanks for making this video. I've always wanted to make video games, especially fps' and this is a great start. Thank you again.
    I'm not sure if you cover this in the next one but when you use the controller to look around it goes super slow.

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

    Thanks so much for this series

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

    Hold on.. HOLD ON, THIS IS AN ACTUAL GOOD TUTORIAL!!!

  • @ferdinandw.8952
    @ferdinandw.8952 Год назад +7

    Can We Please appreciate THAT RUclips SAYS ITS UNREAL ENGINE?

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

    this is so well done. thank u very much.

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

    bro this is so well explained i like it this is helping me more than brackeys XD

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

    Thank you for this series. I have one question, why not just use Rigidbody for gravity and collisions

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

      there are advantages and disadvcantages to move movement methods there are a few videos on it on youtube

  • @pulkitsinha3183
    @pulkitsinha3183 Год назад +35

    For everyone struggling to add scripts into Player, make sure that at the very top of the script after the imports once it's definition starts, the first line looks like
    public class PlayerMotor : MonoBehaviour
    and not
    public class NewBehaviourScript : MonoBehaviour
    (when you're trying writing the PlayerLook script, change name according to the script you're writing).
    For some reason this happens automatically on his screen but I had to do it manually everytime (probably because I didn't set the name of the script immediately on creation the way he did, I switched back to the video first to double check the name then renamed my script, which led to the wrong name being present in the definiton).

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

      still doesn't work

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

      @@LitoMike can you please send me your code because after you change the class it should fix.

    • @tomatosalad953
      @tomatosalad953 11 месяцев назад +1

      Thanks, I also had the same problem and after doing what you've said it worked

    • @drapadon
      @drapadon 11 месяцев назад +1

      ty:)

    • @dylancolin5045
      @dylancolin5045 11 месяцев назад +1

      thanks

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

    Wow, I love how people in the comment helping each other and dropping some tips

  • @teenageapocalypseusa5368
    @teenageapocalypseusa5368 3 месяца назад +1

    My hope is to make a game like FEARS TO FATHOM one day. You have given me a place to begin my journey!

  • @realisticlyunavailable8355
    @realisticlyunavailable8355 2 года назад +6

    Hey, thanks for the tutorial!
    I'm trying to wrap my head around the new Input system so this video is very useful. It also allowed me to try out the character controller for the first time ever.
    I just have a quick question at 10:45, why did you use transform.TransformDirection()? what does it do since the code works just well by just passing in moveDirection.

    • @NattyGameDev
      @NattyGameDev  Год назад +11

      So what TransformDirection is doing is converting our input to local space for our player...
      So pushing [W] will always move our player in the own "forward" facing direction
      If you just used moveDirection however..
      [W] will always move our player forward in the Z axis/ [S] back on the Z Axis
      [A] forward on the X axis/ [D] back on the X axis...
      The direction we move would be fixed in world space.. Which is great for a top-down game.
      Hope that makes sense!! :D

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

    I couldn't figure out why my character wasn't moving so I deleted the project and started over, got to 11:53 and laughed once I heard "we can drag our scripts onto our player." I don't know how I missed that the first time lol.

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

    I'm kinda mind blown, i'm literally just starting with unity... i know some really basic stuff, i didn't understand any kind of vector 2/3 or anything, it was just fun to watch you type something that i do not understand at all, cool vid

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

    This guide is great i actually understand whats going on

  • @ElementRunRL
    @ElementRunRL 9 месяцев назад +8

    After 2 hours of debugging my first code, i finally got the inputs to move, feels good

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

      I feel like I have followed all of the steps but when I run the program my character is not moving. I was wondering whether that is the same as what you had?

    • @Lawreeen
      @Lawreeen 6 месяцев назад

      yeah me too @@jakewatson862

    • @Jayc_405
      @Jayc_405 6 месяцев назад

      @@jakewatson862 i have the same issue, have you found the problem

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

      @@Jayc_405 same have you found the answer

    • @mertylmaz-qu7vd
      @mertylmaz-qu7vd Месяц назад

      set the speed value@@adventuresinhomeschoolingwithb

  • @Alec-hp5nx
    @Alec-hp5nx 2 года назад +150

    Just for some confused people, for me the 2D vector was named as the up/down/left/right composite instead of 2D vector

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

      hey i am on version 2020.3.32f1

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

      @@YT_V4Z0R same I don't understand

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

      Yeah there's only positive and negative binding and another binding with one or two modifier

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

      @@rayhan285 Exactly

    • @joshuang.1154
      @joshuang.1154 2 года назад +124

      @@rayhan285 Click the action, then action type, change it from button to value, then the control type will appear , choose vector 2, then go ahead and click the "+" sign on your action and now it will show add up down left right composite

  • @user-nf1ej6kw3t
    @user-nf1ej6kw3t 10 дней назад

    Really helpful video!

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

    Best tutorial I've ever watched.

  • @CYKLER
    @CYKLER Год назад +46

    For those wondering how to implement the last bit (crouch/sprint) if it is not working you need to make bools and floats underneath the jump height float at the top around line 12, it should look like this
    public float jumpHeight = 3f;
    Public bool lerpCrouch;
    Public bool crouching;
    Public bool sprinting;
    Public float crouchTimer;
    This took me a while to figure out so I hope this helps

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

      Thank you!

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

      Don’t know why he didn’t show that, but thank you for sharing something others might like me need help!

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

      Thank you so so much!

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

      What does the crouchTimer do?

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

      @@damnthishandleistaken I posted this 4 months ago I don’t remember but it works

  • @anonymous_boi
    @anonymous_boi Год назад +63

    Can we all just take a moment to appreciate @Natty Creations, to thank him for all the valuable time of his, he is taking to teach this to us.

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

      bro i think he meant to reply

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

    I`m having a lot of fun making this!

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

    this is a really helpful tutorial. it would be great if you could do a little explanation of what each script does but i've also ben just using chat gpt for that. keep up the good work :)

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

    You can also set the Sprint interaction to be triggered on press and release by adding an Interaction "Press" then set this to trigger on Press and Release, this will allow you to hold the Shift button or mapped keypad button down instead of pressing once to sprint then again to walk.

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

      Likewise, this can be set for the crouch interaction as well but I prefer the press to crouch press to stand method

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

      Thanks! I was trying to figure out how to do this

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

      thanks!!!

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

    Can you jump while you're actually on the object or does that come later? Love this tutorial by the way, keep this series going!

    • @NattyGameDev
      @NattyGameDev  2 года назад +6

      Yeah absolutely ! Since we're using the IsGrounded book from unitys character controller it will set the bool to true when we are on-top of any type of collider, but we do need assign it to our own isGrounded bool in update to get reliable results.

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

    Thank you for the help! currently working on a game for a school project and I've never used unity lol

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

    Thank you for this helpful video 😃

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

    you deserve to be the best unity tutorial channel by far!

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

    this serie looks really good for beginners, but will you cover advanced stuffs like gun types (shotguns, rifles, semi-auto, heavy rifle/snipers, burst) and more advanced player movement (vaulting, double jump, sliding)? It would be great in this serie

  • @mrGAMER-tw9xu
    @mrGAMER-tw9xu Год назад

    bro thank you so much my dream is to become a game developer I had some issues with coding on vs code on Mac but fixed it and everything works thank you so much man I really appreciate it

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

    thankyou for this. Wondering what theme you are using in your VS editor?

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

    Hey, thanks for the awsome video, one thing. When i use the input actions for w/s, instead of moving me along the z axis, it moves me along the y. Any help appreciated. (Beginner)

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

    TURN OFF OTHER COLLIDERS! I had a second capsule collider enabled on my player model and spent HOURS combing through code only to realize the Character controller was colliding with my capsule collider. The results were a phantom pill flying around an arena at mach 5

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

    thank you for this great tutorial

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

    VERY HELPFUL SO FAR!!!! :))))))

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

    Isn't applying a constant downward force in update method very taxing? Can't we just assign all that in a pre-check before we hit the jump input key. I'm still learning so sorry if this is a dumb question.

    • @PrimeCommand
      @PrimeCommand 2 месяца назад

      if you were to walk of an edge you would just float if that were the case I believe

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

    This is my first time coding a game I’ve never been more confused with an error in my life

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

      That used to happen to me a lot. It still does. What error were you having

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

      @@connorpayne2671 I keep getting error CS1061

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

      @@randoavis2 What method are you trying to call

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

      @@connorpayne2671 I managed to fix it

  • @Treasureplayz-ff5lf
    @Treasureplayz-ff5lf 8 месяцев назад

    thanks for the help i am doing this to make my dad proud

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

    Literally the best tutorial I found for mechanics, thank you dude))

  • @vitalityraider650
    @vitalityraider650 2 года назад +80

    nice tutorial but just a suggestion, please dont cut the clips when adding more lines and curly brackets because then it causes more errors in our code, but other than that amazing tutorial!

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

      yes in 7:10 i got an error saying numre blah blah blah

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

      Not rlly annoying for me

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

      @@TheDogWaffle good for you man

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

      Why the heck did u reply, its almost =been an year

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

      @@TheDogWaffle why the heck did you reply to a year old comment

  • @aura-kl
    @aura-kl Год назад +3

    Great tutorial Natty. However I'm stuck on the Jump Controls section, for some reason the player doesn't respond to the Jump Key being pressed. I thought I mite have a dodgey Space Bar but reassinging Jump to another key doesn't work.
    Also the Keyboard Window that opens via the Input Debugger isn't recording the Jump Key being pressed, nor any of the other keys being pressed during play mode, which appear to be working fine. Any ideas why? Thanks

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

    Yo @NattyGameDev nice tutorial! I absolutely love this one, helped a lot.
    One thing I can recommend is that when mapping the Movement action you can use "Pass Through" -> "Stick" and don't use the 2D Vector binding. Instead make a binding as if you are making a regular button and map the "Left Stick" input to the binding. This way you can make pressure-sensitive stick movement. Jeri Izumi out!

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

    Really awesome video thanks

  • @DevNicitis
    @DevNicitis Год назад +10

    The screen jittering issue can occurs in this code when the player moves and rotates the screen simultaneously.
    You can resolve this issue by moving 'motor.ProcessMove(onFoot.Movement.ReadValue());' from the FixedUpdate method to the Update method in InputManager.
    But this might cause many collisions problem. So, I recommend interpolating the rotation.
    Here's the tutorial: ruclips.net/video/qtV8JEIq0Ng/видео.html
    With this solution, you need to rotate the player in the FixedUpdate method.

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

      smoothDeltaTime fixed it for me, but the video is more than helpful

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

      @@maritimeyoutubeengineer3354 how did you implement the smooth delta time. Thank You

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

      Thank you for posting this! I'm trying to continue working on the framework this tutorial provides and that jittering was driving me mad.

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

      @@micol04
      public static float smoothDeltaTime;
      you would put that in the PlayerMotor script near the top around line 12.

  • @brijeshkumbhare5320
    @brijeshkumbhare5320 9 месяцев назад +3

    In the ProcessMove you can add this code to move the player back/front instead of up/down
    float HMove = Input.GetAxis("Horizontal");
    float VMove = Input.GetAxis("Vertical");
    Vector3 moveDirection = new Vector3(HMove, 0.0f, VMove);
    controller.Move(transform.TransformDirection(moveDirection) * speed*Time.deltaTime);

    • @ivanscappini
      @ivanscappini 9 месяцев назад

      THANKS

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

      well no, if youre moving up and down instead of front and back, its because youve typed moveDirection.y = input.y; instead of moveDirection.z = input.y;

    • @Shyonn
      @Shyonn 6 месяцев назад

      rahnosam you are my hero thank you@@TheSaviourOfHumanity

    • @LORDKINGHT
      @LORDKINGHT 6 месяцев назад

      Yeah, my player jump instead of go forward when i pressed W, thanks a lot@@TheSaviourOfHumanity

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

    Congrulations ... You have got 2 new users... woppi

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

    Nvm I figured it out HUGE thanks bro😊

  • @ziyadarif3119
    @ziyadarif3119 Год назад +87

    Bruh does anyone else feel like they are just copying him, but not actually learning anything. Good tutorial but I feel that it moves a bit too fast without explaining how we can do this ourselves.

    • @ProDelta25
      @ProDelta25 4 месяца назад +5

      Bro sameeee

    • @StandupWind709
      @StandupWind709 4 месяца назад +3

      At about 7:42 what app does he use?

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

      ​@@StandupWind709 Visual Studio

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

      @@StandupWind709visual studio

    • @der-Dritte
      @der-Dritte 4 месяца назад +3

      I would recommend to understand and write a code in a different way. Like what does it and try to write a unique code

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

    hello, thank you for the tutorial so far. if you can, i have an issue where instead of my player moving forwards and backwards they move up and down on the Y axis. im not sure if i missed somethin g in the video or not. ((:

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

      i also just realised my moving left and right is inverted D:

    • @edwardchew5139
      @edwardchew5139 2 года назад +6

      The line that's causing this should be under "public void ProcessMove(Vector2 input)"
      and you might have set the move direction.z as y instead of z
      {
      Vector3 moveDirection = Vector3.zero;
      moveDirection.x = input.x;
      moveDirection.z = input.y;
      }

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

      @@edwardchew5139 tysm i also had this problem and you fixed it

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

      @@edwardchew5139 thank you had this same problem had a feeling that this was the problem it work now.

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

    LOL that Himym reference though!

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

    Comment for the Algorythm, Great Work!

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

    I spent 4 hours fixing small bugs and issues I had, but I am very happy and surprised I managed to fix them without any help and was very happy with the result. But I do need some help, it will not let me add the scripts to the player even with no errors, do you know how I can fix that. Thanks for the awesome tutorials!

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

      I'm having the same problem. I do not understand this as I am new to coding and Unity. :(

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

    Hi, I wanna know why my camera can't look down and up ? I totally follow the steps you did but I can't look up and down in the game.

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

      Doublecheck your player look code. Make sure you're using the correct symbols:
      xRotation -= (mouseY * Time.deltaTime) * ySensitivity; --> Note the "-="
      xRotation = Mathf.Clamp(xRotation, -80f , 80f); --> note the =

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

    the part where you added controls for gamepad made me think about publishing my game

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

    Loved the tutorial! One question, when I look around i want to go forward towards the why I am looking, how would I go about accomplishing this.

  • @dylanbackstrum8856
    @dylanbackstrum8856 3 месяца назад +6

    can anyone help? At 11:08 I'm stuck, it says that "PlayerMotor" doesn't exist in the line "private PlayerMotor motor;"

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

      Same idk what to do. If u have got it kindly reply

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

      @@pranathisrivatsa1806: I'm assuming you guys have a 'typo'.
      [PlayerMotor.cs]
      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      /// Class Containing Player Movement Functionality
      public class PlayerMotor : MonoBehaviour
      {
      private CharacterController controller;
      private Vector3 playerVolocity;
      public float speed = 5F;
      // Start is called before the first frame update
      void Start()
      {
      }
      // Update is called once per frame
      void Update()
      {
      }
      /// Receive the Inputs for the InputManager.cs and Apply them to the Character Controller.
      ///
      public void ProcessMove(Vector2 input)
      {
      Vector3 moveDirection = Vector3.zero;
      moveDirection.x = input.x;
      moveDirection.y = input.y;
      controller.Move(transform.TransformDirection(moveDirection) * speed * Time.deltaTime);
      }
      }
      [InputManager.cs]
      using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      using UnityEngine.InputSystem;
      /// Class that manages all the Keyboard and GamePad Inputs.
      public class NewBehaviourScript : MonoBehaviour
      {
      private PlayerInput playerInput;
      private PlayerInput.OnFootActions onFoot;
      private PlayerMotor playerMotor;
      // Start is called before the first frame update
      void Awake()
      {
      playerInput = new PlayerInput();
      onFoot = playerInput.OnFoot;
      playerMotor = GetComponent();
      }
      // Update is called once per frame
      void FixedUpdate()
      {
      // > Tell the Player Motor to Move using the Value from our Movement Action
      playerMotor.ProcessMove(onFoot.Movement.ReadValue());
      }
      private void OnEnable()
      {
      onFoot.Enable();
      }
      private void OnDisable()
      {
      onFoot.Disable();
      }
      }