FIRST PERSON MOVEMENT in Unity - FPS Controller

  Рет қаралды 3,292,316

Brackeys

Brackeys

Күн бұрын

Пікірлер
@Danidev
@Danidev 5 жыл бұрын
Yeeey you're finally back! Been waiting for this one! :DDD
@pharmacist66
@pharmacist66 5 жыл бұрын
Dani Man you’re fast I just got the notification
@crowgaming7156
@crowgaming7156 5 жыл бұрын
hi
@Beengus
@Beengus 5 жыл бұрын
WHERES MY MOBILE PORTS NERD
@user-ob5hj5vn8c
@user-ob5hj5vn8c 5 жыл бұрын
Dani your the man, keep up your devlogs my dude.
@AB-hr4qg
@AB-hr4qg 5 жыл бұрын
I played karlson for 2 hours .... idk why
@godot-boy7694
@godot-boy7694 4 жыл бұрын
Mr. Brackeys we noobs will always respect you as our teacher. You left KZbin but you cannot leave our hearts, sir.
@BluePhantomStudio
@BluePhantomStudio 4 жыл бұрын
why is he not responding?
@zaimy5779
@zaimy5779 4 жыл бұрын
*salut*
@jacobbern9591
@jacobbern9591 4 жыл бұрын
may he teach us trough eventually out dated videos
@vozzy06
@vozzy06 4 жыл бұрын
Yash :The Gaming Boy i think he didnt look up his youtube page again
@sandroalderucci7949
@sandroalderucci7949 4 жыл бұрын
amen
@None-nh3xb
@None-nh3xb 4 жыл бұрын
4:51 Mouse Controls 11:13 Key Controls 15:14 Gravity 21:21 Jumping
@ANZARIZ_43
@ANZARIZ_43 4 жыл бұрын
thanks
@kepleda
@kepleda 4 жыл бұрын
Let's Make This The Top Comment
@aprameyanaganur2934
@aprameyanaganur2934 4 жыл бұрын
Nice. Pin this comment Brackeys!
@thereaper5847
@thereaper5847 4 жыл бұрын
BRACKEY PIN THIS
@thereaper5847
@thereaper5847 4 жыл бұрын
Who just liked my comment
@bonestudios7777
@bonestudios7777 Жыл бұрын
4 years in and this is one of the best movement tutorial that I found out there
@Iwan._
@Iwan._ 6 ай бұрын
I found it once and use it every time till today
@vario1305
@vario1305 Ай бұрын
@@Iwan._ Same man but i stoped game dev went to unreal came back to unity because i cant run unreal.
@redliam5
@redliam5 5 жыл бұрын
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 5 жыл бұрын
Similar! I think huh what if bracket did first per- New video 🤔
@thellamawaffle6817
@thellamawaffle6817 5 жыл бұрын
yeah! what is up with that..?
@Gamer-uf1kl
@Gamer-uf1kl 5 жыл бұрын
I am new here so the most types of game i make are here
@catacylist2933
@catacylist2933 4 жыл бұрын
What if brackets did a mech game tutorial
@test_12125
@test_12125 4 жыл бұрын
Can you look my mobile game "Block Puzzle Colorful", it is a relaxing game (Android/iOs) Give it a try, i just published the game, it is free. i have a youtube channel also
@whugnong
@whugnong 4 жыл бұрын
me: trying to slowly and methodically type out a script. brackeys: I AM SPEED.
@StarzzDrak
@StarzzDrak 4 жыл бұрын
bruh i have the same problem except i need to set video speed to 1.25 :D
@stupidrobot7896
@stupidrobot7896 4 жыл бұрын
StarzzDrak good for you but.... we didn’t need to know that
@StarzzDrak
@StarzzDrak 4 жыл бұрын
@@stupidrobot7896 yes but its life struggle for both of us.. that was the point
@SwedishVikingMC
@SwedishVikingMC 4 жыл бұрын
@@StarzzDrak Why are you watching a beginner tutorial if you're a more experienced programmer? lol
@StarzzDrak
@StarzzDrak 4 жыл бұрын
@@SwedishVikingMCbruh why not ? I haven't created a single 3d character controller in 3 years
@SrStakeholder
@SrStakeholder 5 жыл бұрын
I heard that Bethesda offices doesn’t have doors, the staff just clip trough the walls.
@mfatihbilhaq4977
@mfatihbilhaq4977 5 жыл бұрын
Yep that required 100$/year.
@SubjektDelta
@SubjektDelta 5 жыл бұрын
@ yes you are, not joking.
@skaruts
@skaruts 5 жыл бұрын
lol you made my day. :D
@Cxdyy
@Cxdyy 5 жыл бұрын
Lmaoooooooooooooooooooooooooooooooooooooooooooooooo
@drimpossible5078
@drimpossible5078 5 жыл бұрын
congradulations every one liked this
@BaconBuddie34
@BaconBuddie34 2 жыл бұрын
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 Жыл бұрын
Exactly the same here!
@FYFTYNDIGITSLoF
@FYFTYNDIGITSLoF 9 ай бұрын
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
@letthatbe
@letthatbe 7 ай бұрын
But you have given up right? :D
@FYFTYNDIGITSLoF
@FYFTYNDIGITSLoF 7 ай бұрын
@@letthatbe nope
@pumpkinpyewastaken
@pumpkinpyewastaken 6 ай бұрын
This doesn't work for me. The code shown at 10:19 is not working for me. Unity says "The name "Qauternion" does not exist in the current context"
@zacoriot
@zacoriot 4 жыл бұрын
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 4 жыл бұрын
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 4 жыл бұрын
Alt + f4 I believe is good
@yeahnope2349
@yeahnope2349 4 жыл бұрын
@@bobdagamer640 For a split second, i went "Huh I didn't know they could do tha-- wait a second...
@bobdagamer640
@bobdagamer640 4 жыл бұрын
Lol
@Kortenue
@Kortenue 4 жыл бұрын
I forgot a comma when that almost happened
@labscience8271
@labscience8271 3 жыл бұрын
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 3 жыл бұрын
Same bro :(
@frostblock_12
@frostblock_12 3 жыл бұрын
thanks my dude
@MMithy
@MMithy 3 жыл бұрын
@@Boogaloo69 same :(
@yourmum69_420
@yourmum69_420 3 жыл бұрын
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 3 жыл бұрын
Thanks for this bro
@sykoo
@sykoo 5 жыл бұрын
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!
@theonlyasher
@theonlyasher 4 жыл бұрын
Sykooooooooooooooooooo
@thecomputez-gaming8427
@thecomputez-gaming8427 4 жыл бұрын
@AlanTheGamerWolf wdym sykoo is lit
@age9502
@age9502 4 жыл бұрын
Only 3 comment
@iantakacs8771
@iantakacs8771 3 жыл бұрын
mmmm moss cake
@jeremiahruiz9686
@jeremiahruiz9686 3 жыл бұрын
the best level creator
@bernardmasika
@bernardmasika Жыл бұрын
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
@amanewithjesus
@amanewithjesus Жыл бұрын
Jesus is lord follow him and you will be saved
@Yoctopory
@Yoctopory Жыл бұрын
@@amanewithjesus What's wrong with you?
@viola_case
@viola_case 3 жыл бұрын
Brackeys tutorials will always be my go-to because his smile makes me feel welcome and ready to learn.
@josephjohn9215
@josephjohn9215 3 жыл бұрын
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 3 жыл бұрын
@@josephjohn9215 I think you meant to put this in the main video thread? I don't know how to fix your problem.
@josephjohn9215
@josephjohn9215 3 жыл бұрын
@@viola_case thank you, but someone else helped me
@Couldbeme
@Couldbeme 3 жыл бұрын
@@josephjohn9215 what'd they say
@josephjohn9215
@josephjohn9215 3 жыл бұрын
@@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 )
@Yoctopory
@Yoctopory 3 жыл бұрын
God creating the universe: "..and of course let's multiply with Time.deltaTime".
@marshgd
@marshgd 3 жыл бұрын
lol
@vaglo701
@vaglo701 3 жыл бұрын
underrated xd
@otsvtsu7i
@otsvtsu7i 3 жыл бұрын
HAHAHAHA
@Aries-tp8sk
@Aries-tp8sk 3 жыл бұрын
69th like
@Yoctopory
@Yoctopory 3 жыл бұрын
@@Aries-tp8sk nice ;)
@thewatermelon_thing7083
@thewatermelon_thing7083 3 жыл бұрын
Unity: "No errors detected!" Me: Falling through the ground at 5000 miles per hour.
@p4tk47
@p4tk47 3 жыл бұрын
Unity: "No Errors detected" Me: Jump, no :(
@leonardpertsch8784
@leonardpertsch8784 3 жыл бұрын
@@p4tk47 same. did you fix it?
@hamoodibtw5550
@hamoodibtw5550 3 жыл бұрын
how to fix?
@skphotography6982
@skphotography6982 3 жыл бұрын
@@p4tk47 SAME
@francomarini6311
@francomarini6311 3 жыл бұрын
do you have a terrain or a plane with a collider on it?
@arkilusreal
@arkilusreal 2 жыл бұрын
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 2 жыл бұрын
@@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 2 жыл бұрын
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 2 жыл бұрын
@@arkilusreal its ok, actually I figure it out. Thank you very much for responding!
@casssaph2287
@casssaph2287 4 жыл бұрын
me: sees "quaternion" me: "ok so basically its black magic and i dont need to know how it works"
@youneskasdi
@youneskasdi 4 жыл бұрын
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 4 жыл бұрын
@@youneskasdi i did an oopsie... i dug into it you weren't wrong, my head hurts
@scorpoinlol97
@scorpoinlol97 4 жыл бұрын
@@dzvidea5065 same here
@thealgomanxr
@thealgomanxr 4 жыл бұрын
@@youneskasdi I read an article about it and understand absolutely nothing
@copperwires9663
@copperwires9663 4 жыл бұрын
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
@kingkodo7184
@kingkodo7184 5 жыл бұрын
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 5 жыл бұрын
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!
@tamaskisely
@tamaskisely 5 жыл бұрын
Could somebody please be more specific? ( I mean explain this in a more detailed way) Thanks
@equation1321
@equation1321 5 жыл бұрын
Hello
@llakuawyus7326
@llakuawyus7326 5 жыл бұрын
@@tamaskisely Yeah a bit more detail would help a lot lol.
@TheCivildecay
@TheCivildecay 5 жыл бұрын
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)
@susseratal
@susseratal 4 жыл бұрын
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 жыл бұрын
@@speedyturtle1537 why are you spamming that everywhere
@CreativeUsernameHere-r1k
@CreativeUsernameHere-r1k 4 жыл бұрын
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 жыл бұрын
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.
@CreativeUsernameHere-r1k
@CreativeUsernameHere-r1k 4 жыл бұрын
@@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
@fearedwolf1731
@fearedwolf1731 2 жыл бұрын
Brackeys I almost quit watching you becuase I thought unity cost money but now im back and realised your my best source of knowlage.
@basilbravo6361
@basilbravo6361 3 жыл бұрын
me: types the code and follows each step carefully. unity: 249 errors take it or leave it.
@Mr-px4nz
@Mr-px4nz 3 жыл бұрын
I also have such a problem. Can anyone help with that? :(
@tverroryt
@tverroryt 3 жыл бұрын
@Liftnop i have so much erors
@sembos1151
@sembos1151 3 жыл бұрын
@@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); } }
@youtubespyder4389
@youtubespyder4389 3 жыл бұрын
dude thats something thats weird
@arandomeditor972
@arandomeditor972 3 жыл бұрын
Pls help I followed all the steps but it says file missing when I try to add movement
@LegndGames_YT
@LegndGames_YT 4 жыл бұрын
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 жыл бұрын
Thanks for the tip, it removed the stuttering for me!
@LegndGames_YT
@LegndGames_YT 4 жыл бұрын
@@pepijnvb1484 No problem! Glad to help :)
@karter6632
@karter6632 4 жыл бұрын
@@LegndGames_YT how do i do this
@karter6632
@karter6632 4 жыл бұрын
@@LegndGames_YT how do i do this
@LegndGames_YT
@LegndGames_YT 4 жыл бұрын
@@karter6632 Simply remove Time.deltaTime from the MouseLook script :)
@kieranwiggy2522
@kieranwiggy2522 4 жыл бұрын
Everyone is back here since we are all in quarantine
@Dom4321
@Dom4321 4 жыл бұрын
Hell Yeah
@unclerandy398
@unclerandy398 4 жыл бұрын
yup
@voicehead
@voicehead 4 жыл бұрын
oh yeah
@julianeyt4059
@julianeyt4059 4 жыл бұрын
after this is over we will have millions of new game developer XD
@aquah2080
@aquah2080 4 жыл бұрын
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
@MemesChannel7531
@MemesChannel7531 Жыл бұрын
The Fact That I Learned 3D Movement Script. YOU ARE JUST AWESOME
@xrotator8986
@xrotator8986 4 жыл бұрын
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
@CodexCornerGames
@CodexCornerGames 4 жыл бұрын
Can anyone help me?Whenever I press spacebar the player doesnt do anything.I can move and look around though.
@FaruukNN
@FaruukNN 4 жыл бұрын
@@CodexCornerGames you should check your groundcheck :d
@bobsapdagger
@bobsapdagger 4 жыл бұрын
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 4 жыл бұрын
couldn't have said it better
@marcusaddison8866
@marcusaddison8866 4 жыл бұрын
Out ranks all those satisfying video compilations on KZbin
@CodexCornerGames
@CodexCornerGames 4 жыл бұрын
Can anyone help me? I have a problem where I cant jump even though I copied the exact code.
@eeevoo
@eeevoo 4 жыл бұрын
@@CodexCornerGames Did you assign the script to the player?
@CodexCornerGames
@CodexCornerGames 4 жыл бұрын
​@@eeevoo Yes.
@AlexandruAlexe07
@AlexandruAlexe07 3 жыл бұрын
me: I will do this by myself also me at 12 am: Brackeys tutorial fps movement
@labscience8271
@labscience8271 3 жыл бұрын
Hahahha same. I'm a noob. I can't do it without Brackeys
@cubecraftgaming9669
@cubecraftgaming9669 3 жыл бұрын
@@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! 😁
@pugwilldestroygaming9769
@pugwilldestroygaming9769 2 жыл бұрын
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
@everydayisntnormal6945
@everydayisntnormal6945 2 жыл бұрын
wow
@IamDrDapper
@IamDrDapper 2 жыл бұрын
Genius
@BreadAckerman
@BreadAckerman Жыл бұрын
God damn it he must not live he possesses the "i will improvise" strategy.
@no8053
@no8053 4 жыл бұрын
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
@meeblesneeble
@meeblesneeble 3 жыл бұрын
If anyone is having issues with the line involving "MathF", its "Mathf" now. Hope this helps!
@alexbrooks128
@alexbrooks128 3 жыл бұрын
@nostalgia television just tryna help bro chill
@alephcake
@alephcake 3 жыл бұрын
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
@ScrollNTold
@ScrollNTold 4 жыл бұрын
me: following every step he makes The Word/letter color: is different me: there's something wrong I can feel it
@mage3690
@mage3690 4 жыл бұрын
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 жыл бұрын
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 4 жыл бұрын
imagine A third-person game, but it's a first-person game
@isaacsworld1177
@isaacsworld1177 4 жыл бұрын
😒
@oscarfacecamplz8264
@oscarfacecamplz8264 4 жыл бұрын
If it in color. What happens I’m new to Unity please help me it says when I hit play remove the compiler errors.
@hmmmmm8716
@hmmmmm8716 2 жыл бұрын
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 2 жыл бұрын
Make sure you add the camera as a child object to the player
@vasatruhl
@vasatruhl 2 жыл бұрын
Brackeys is a life saver :D
@BishalKhan01
@BishalKhan01 5 жыл бұрын
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
@nietzsche14
@nietzsche14 3 жыл бұрын
Me acting like I understand and am not just copying everything he is doing. "mhmmmm"
@davez2796
@davez2796 3 жыл бұрын
hhahhahah same
@sillymortalz
@sillymortalz 3 жыл бұрын
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 3 жыл бұрын
@@sillymortalz Same XD
@lakshyakumar4459
@lakshyakumar4459 3 жыл бұрын
please help my code isnt working
@lakshyakumar4459
@lakshyakumar4459 3 жыл бұрын
if once i added the ycode for it to move p and down only that worked it stopped looking aroud i reallycant explain
@iilliot
@iilliot 4 жыл бұрын
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 4 жыл бұрын
where do i pu tthe comma it wants me to put a comma WHERE IS IT AAAAAAAAAA
@snoutgames4940
@snoutgames4940 4 жыл бұрын
i've done that so much lol
@TinyDeskEngineer
@TinyDeskEngineer 4 жыл бұрын
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_ 4 жыл бұрын
ctrl s am i joke to you
@thewindowgames2610
@thewindowgames2610 4 жыл бұрын
Dang, I hate when that happens
@mesopithecus8622
@mesopithecus8622 2 жыл бұрын
Little late, but here is a way you can add Sprint: Set speed to a private variable with no value.(private float speed;) Add something like: public float runSpeed = 20f; public float walkSpeed = 12f; (You don't have to use these values, change them to what you want.) if(Input.GetButton("")) { speed = runSpeed; } else { speed = walkSpeed; } Note that you can also use Input.GetKey, but I prefer GetButton(as it gives you lets you do more, and because it is then really easy to remap controls) Hope this helps.
@user-er3kw8hv7i
@user-er3kw8hv7i 2 жыл бұрын
whats the key for left shift?
@mesopithecus8622
@mesopithecus8622 2 жыл бұрын
@@user-er3kw8hv7i You could use GetKey(KeyCode.LeftShift) But I recommend going to the input manager and setup a left shift button. You could look up a tutorial online, or if you can't find one i could make on for you
@Ze_N00B
@Ze_N00B 2 жыл бұрын
@@user-er3kw8hv7i it's "left shift". Go into Edit>Manage Settings > Input Manager, expand the axis limit, rename the newest axis to "Sprint" or what have you, then input "left shift" where the positive action is. Then write the name "Sprint" in your code to have it use it.
@NotMrLex
@NotMrLex 2 жыл бұрын
thank you very kind stranger.
@sohodollie7643
@sohodollie7643 2 жыл бұрын
You can also check if the character is grounded. If the character is grounded, change speed = runSpeed and deplete a stamina bar, if the character is in the air, dont change speed at all. you could also add a "dash" button that increases horizontal velocity in the forward direction to let you dash mid-air
@maxdukhovskoy1406
@maxdukhovskoy1406 4 жыл бұрын
Me: "ok, I copied this perfectly, it should work..." Unity: nah, we don't do that here.
@kanesiajones4407
@kanesiajones4407 4 жыл бұрын
Use 2019.4 either that or your a lire
@azzy1220
@azzy1220 4 жыл бұрын
@@kanesiajones4407 r/woooosh
@FunnyTypeChi
@FunnyTypeChi 4 жыл бұрын
@@kanesiajones4407 r/woooosh
@jihannireshwalia7603
@jihannireshwalia7603 4 жыл бұрын
@@kanesiajones4407 r/woooosh
@whoisthisuserthough
@whoisthisuserthough 4 жыл бұрын
@@kanesiajones4407 r/woooosh
@datblue1104
@datblue1104 4 жыл бұрын
Brackeys: "And now we should be able to move around" My Character: " *_YEET gdf bngrsdts ytnw eaygfdfgbv_* "
@eddybplayz4801
@eddybplayz4801 4 жыл бұрын
@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 4 жыл бұрын
@DRAGO YT GAMING Why do you use a capital at the start of every word?
@nutellacheese6017
@nutellacheese6017 4 жыл бұрын
Lolol
@user-ji3tc7ut8k
@user-ji3tc7ut8k 4 жыл бұрын
@@aheavyofculture C# is cap sensitive
@aheavyofculture
@aheavyofculture 4 жыл бұрын
@@user-ji3tc7ut8k so?
@MathRavn
@MathRavn 4 жыл бұрын
This is the most relatable comment section I've ever seen
@akki3535
@akki3535 4 жыл бұрын
I agree lol
@oakamaam
@oakamaam 4 жыл бұрын
reletable :0
@MathRavn
@MathRavn 4 жыл бұрын
@@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
@mjdragon13
@mjdragon13 2 жыл бұрын
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 2 жыл бұрын
sorry it didnt work for me
@raffe7889
@raffe7889 4 жыл бұрын
I can't believe Brackeys is gone ;_; Their content is still amazing though and they made A LOT of it
@TheCorruptClown32518
@TheCorruptClown32518 4 жыл бұрын
Wut happened
@DemonPig666
@DemonPig666 4 жыл бұрын
😭😭
@FuzzyWeasel
@FuzzyWeasel 4 жыл бұрын
I know.its sad. But I think codeMonkey still makes videos. You could check him out
@emirhansoyluBF
@emirhansoyluBF 3 жыл бұрын
I'm still crying :''''(((((
@faisalalodat9037
@faisalalodat9037 3 жыл бұрын
:(
@tres-2b299
@tres-2b299 3 жыл бұрын
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!
@connorkerrigan3582
@connorkerrigan3582 5 жыл бұрын
i laughed so hard when my guy slowly started floating up into the sky
@rexss90
@rexss90 5 жыл бұрын
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 5 жыл бұрын
@@rexss90 go into your player and make sure the gravity is negative
@rexss90
@rexss90 5 жыл бұрын
@@nautics9927 Thanks, i figured it out finally!
@CrazyJoven
@CrazyJoven 4 жыл бұрын
@@nautics9927 THANK YOU!!
@nautics9927
@nautics9927 4 жыл бұрын
@@CrazyJoven no problem
@phillipdean9830
@phillipdean9830 Жыл бұрын
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!
@fabiosfree
@fabiosfree 4 жыл бұрын
Me: Copies perfectly Unity: 964 ERRORS
@aravind.s1187
@aravind.s1187 4 жыл бұрын
LOL
@TKTC_The_Key
@TKTC_The_Key 4 жыл бұрын
Only?
@fabiosfree
@fabiosfree 4 жыл бұрын
@@TKTC_The_Key Yea!. Im just good like that.
@faynon8765
@faynon8765 4 жыл бұрын
you forget the dot '-'
@tfeak2101
@tfeak2101 4 жыл бұрын
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.
@nicolaicardinale7902
@nicolaicardinale7902 3 жыл бұрын
It's 2021 and this video is still a GODSEND. thank you so much for not just good instructions but clear ones.
@davidmcasas
@davidmcasas 4 жыл бұрын
Hi, I wanted to share a tip since I believe something may not be 100% correct in this tutorial. I followed it through, in Unity 2019.4 with the same script you wrote and got it to work, however, I noticed that when I tried to jump pushing against a wall, the jump was jittery and incomplete in height. After much headache and a lot of googling, I found out that CharacterController may act weird if you call the Move function more than once within an Update function. In your script you are calling it twice: one for the X and Z movement, and other for the vertical movement. I believe that the right way to do it is to just call it once, with a single Vector3 that combines the 3 directions. I did it this way and the jitter stopped and everything's fine. So I recommend anyone who has any problem to try to call the Move function just once. However, to do this, you need to multiply the speed before, and not within the Move call, because you don't want the plain speed to have effect on the vertical movement: Vector3 move = transform.right * x * speed + transform.forward * z * speed + transform.up * verticalVelocity; controller.Move(move * Time.deltaTime); Please note that I'm new to Unity and still learning, however this worked for me and fixed the jittering while maintaining the same functionality, I hope it helps.
@aresstavropoulos916
@aresstavropoulos916 4 жыл бұрын
Damn I love u I was about to give up and saw your comment.
@kyledunbar9255
@kyledunbar9255 4 жыл бұрын
you legend. came back to the comments just to see if anyone had a fix for this
@blasfah1909
@blasfah1909 4 жыл бұрын
vertical velocity does not exist in the current context
@davidmcasas
@davidmcasas 4 жыл бұрын
@@blasfah1909 sorry my "verticalVelocity" is a float which corresponds to "velocity.y" in the video, I just used a float instead of a vector3 for the jump since I noted that he was only using one axis of that vector3
@Daniel-qf6kz
@Daniel-qf6kz 4 жыл бұрын
@@davidmcasas hey dude im a very new programmer i keep getting this error if u want could u help me fix it? Assets\scripts\PlayerMovement.cs(10,28): error CS0266: Cannot implicitly convert type 'double' to 'float'. An explicit conversion exists (are you missing a cast?) heres my code using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerMovement : MonoBehaviour { public CharacterController controller; public float speed = 12f; public float gravity = -9.81; 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 * speed + transform.forward * z * speed + transform.up * velocity.y; controller.Move(move * Time.deltaTime); velocity.y += gravity * Time.deltaTime; } }
@fluberdebluber7566
@fluberdebluber7566 7 ай бұрын
Im totally fresh to this, and when all the other tutorials buried me in errors this one was a saving grace! Thank you so much!
@talion9289
@talion9289 3 жыл бұрын
I watched this video about a year ago, realised i understood none of it, learned some coding in the meantime in 2D and now came back to it to get a working FPS controller, ty brackeys
@dcry1003
@dcry1003 3 жыл бұрын
Hey mate just asking how can i can i turn this fps script into a mobile controller? Using UI Buttons?
@noobyeeter
@noobyeeter 2 жыл бұрын
LETS GOOOOO! someone plays titanfall!
@bagger1451
@bagger1451 2 жыл бұрын
Me: Copys his code perfectly Unity: 341 Errors Me: Adds 1 letter Unity: Perfect.
@lcj3_
@lcj3_ 2 жыл бұрын
fax man me: **Forgets to put a semicolon** Unity: This semicolon will ruin your life now.
@Ikaros-fo5cb
@Ikaros-fo5cb 2 жыл бұрын
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 жыл бұрын
@@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
@RichAndDianaWilliams
@RichAndDianaWilliams 3 жыл бұрын
Good tut! The physics stuff is cool and it's interesting to see how "real" physics isn't quite what we expect in games.
@Phniblet
@Phniblet Жыл бұрын
The best general unity player movement tutorial on youtube!
@MidasClutch
@MidasClutch 3 жыл бұрын
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 жыл бұрын
Space in btw mouse and Y?
@learnenglishinhouse3102
@learnenglishinhouse3102 3 жыл бұрын
error because the space, is "Mouse Y"
@sohamacharya171
@sohamacharya171 3 жыл бұрын
A catch 22 situation.
@fillament
@fillament 3 жыл бұрын
That happens too much.
@sylinder__2633
@sylinder__2633 3 жыл бұрын
personally it says i have to setup mouse x but i dont know how to do it
@henrylawrence8562
@henrylawrence8562 4 жыл бұрын
Just a tip to beginner programmers on C# from a beginner programmer with C#: use the unity scripting API. It's an online Unity "Dictionary" and explains a lot of the built in Unity functions. Use. It. Especially if you do not understand any words or functions because of a lack of knowledge, which is normal, but just know that this is a very good help.
@equation1321
@equation1321 4 жыл бұрын
Henry Lawrence thnx
@georgebooth6441
@georgebooth6441 4 жыл бұрын
Me: Gravity doesn't work. Me: "Alright I'll continue in about 3 years,"
@tinsku332Xd
@tinsku332Xd 4 жыл бұрын
@Torben Kauth it worked for me
@jayjayjay-er9ex
@jayjayjay-er9ex 4 жыл бұрын
@@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 4 жыл бұрын
@@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 4 жыл бұрын
@@tinsku332Xd thank you sososososososososo much
@jayjayjay-er9ex
@jayjayjay-er9ex 4 жыл бұрын
@@tinsku332Xd i copied and pasted your code but no luck. same as before :(
@kapex6405
@kapex6405 2 жыл бұрын
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); } }
@Termosulboreas
@Termosulboreas 2 жыл бұрын
legend
@Termosulboreas
@Termosulboreas 2 жыл бұрын
@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
@Termosulboreas
@Termosulboreas 2 жыл бұрын
@@Pepagg8 not important
@volk4342
@volk4342 2 жыл бұрын
If you wanna learn don’t copy this
@boysminecraftianos469
@boysminecraftianos469 4 жыл бұрын
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 жыл бұрын
Everyone copies code at first you will learn gradually over time
@davidfails2866
@davidfails2866 4 жыл бұрын
Haha... Explain them to me im too lazy to look them up
@linshu6141
@linshu6141 4 жыл бұрын
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 жыл бұрын
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).
@TheAmazingPyro99
@TheAmazingPyro99 3 жыл бұрын
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 жыл бұрын
let me guess. transform and Transform?
@jangamer2971
@jangamer2971 3 жыл бұрын
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 жыл бұрын
@@jangamer2971 bruh
@Pre1ude0
@Pre1ude0 3 жыл бұрын
I have the same problem
@Yoctopory
@Yoctopory 3 жыл бұрын
So in fact you DIDN'T copy the code perfectly ;)
@jacobfenech7662
@jacobfenech7662 4 жыл бұрын
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 жыл бұрын
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 жыл бұрын
same
@InsaneJumpscare
@InsaneJumpscare 4 жыл бұрын
@@salemisjuucy compiled errors
@NielsKnives
@NielsKnives 4 жыл бұрын
I m 12 and i get it
@InsaneJumpscare
@InsaneJumpscare 4 жыл бұрын
N M video's but it still has errors, am I using the wrong coding app? I am using c# visual studio
@random_guy-rz8vz
@random_guy-rz8vz 10 ай бұрын
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!
@zimistic6680
@zimistic6680 3 жыл бұрын
“Man coding is so easy and works every time!” -nobody on planet earth
@jacobjackson8619
@jacobjackson8619 3 жыл бұрын
if i hear anyone say this, i smack their face with the errors i got in the last 5 mins
@doge7831
@doge7831 3 жыл бұрын
I got 999+ errors in 5 minutes of coding.
@noamyairperelman875
@noamyairperelman875 3 жыл бұрын
@@doge7831 me to
@ruddydd4085
@ruddydd4085 3 жыл бұрын
truth :p
@shadybandit7
@shadybandit7 3 жыл бұрын
its actually ez and i didn't get any erro
@magicdragon3725
@magicdragon3725 3 жыл бұрын
When you're like, "What's wrong, nothing is showing up" but you forgot to save.
@robloxreviewer-z6m
@robloxreviewer-z6m 3 жыл бұрын
Or when you forgot to put a semicolon at the end of a line of code
@thespeediestgonzales7704
@thespeediestgonzales7704 3 жыл бұрын
@@robloxreviewer-z6m or when you accidentally write code after a semicolon and leave it there in addition to a semicolon at the end
@alphaa2182
@alphaa2182 3 жыл бұрын
@@thespeediestgonzales7704 Or when you forgetting the multiplication dash adjacent to the vector
@CottonCandySnake101
@CottonCandySnake101 3 жыл бұрын
THAT WAS MY ISSUE THANK YOU SO MUCH
@magicdragon3725
@magicdragon3725 3 жыл бұрын
@@CottonCandySnake101 np
@breadnotseen4292
@breadnotseen4292 3 жыл бұрын
I know this will probably get buried and that this is kinda common knowledge but I found out how to add sprint! if (Input.GetKey("left shift") && isGrounded) { speed = 20f; } else { speed = 12f; }
@MimsTwo
@MimsTwo 3 жыл бұрын
Thanks!
@wolfster7776
@wolfster7776 3 жыл бұрын
Amazing it is working Tx
@poizan8460
@poizan8460 3 жыл бұрын
you shouldn't add the && isGrounded, since sprinting make's you jump abit further ahead! Just saying though ;)
@wolfster7776
@wolfster7776 3 жыл бұрын
ohh
@jcdenton7273
@jcdenton7273 3 жыл бұрын
dont put the && isGrounded as Poizan said, instead wrap it in an if statement like this: if (isGrounded) { if (Input.GetKey("left shift")) { speed = 20f; } else { speed = 12f; } }
@haydenmcturk2329
@haydenmcturk2329 2 жыл бұрын
Something really quick for everyone getting into to unity and game design that use this character controller. A lot of tutorials when it comes to character controllers will use rigid bodies to move their character but this one doesn't, so when it comes to converting this character controller over to tutorials that use rigid bodies, notably this script is for all purposes your rigid body, its not a rigid body but will act like one for you. 1. when they call rigid bodies, make sure you call your player movement script instead. So that would look like this public PlayerMovement pm, instead of public rigidbody rb 2, terms that use rb.gravity go to pm.gravity instead, this is the same for rb.velocity just goes to pm.velocity. bear in mind this isn't 1 to 1 like adding force to a rigid body does require some workarounds as we can't add force to something that doesn't have a rigid body, that will look something like this. pm.velocity = transform.forward * 50f; we are effectively adding a force in the forward direction which is the z axis and then adding a speed in the last parameter, if you wanted to move left or right simply change forward for your direction of choice.
@Rat_Latte
@Rat_Latte Жыл бұрын
Thank you so much this helped a lot lol.
@Semmetje11lolly
@Semmetje11lolly 3 жыл бұрын
2:49 video starts here (for myself, because I'll be coming back here A LOT)
@thunderbear06playsstuff63
@thunderbear06playsstuff63 3 жыл бұрын
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
@redspartan7772
@redspartan7772 3 жыл бұрын
There’s nothing better than that feeling when you complete some code and get no errors
@shard7572
@shard7572 3 жыл бұрын
Ah, yes that feeling when the stars align
@mrgibus8278
@mrgibus8278 3 жыл бұрын
Sadly, for me that is a feeling I have yet to expirience
@goodgamershow6505
@goodgamershow6505 3 жыл бұрын
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 3 жыл бұрын
A worse thing is when you have no errors but it still doesn't work.
@ionutdaniel4059
@ionutdaniel4059 3 жыл бұрын
I got no errors *Starts the game and tries to move camera* unity: best i can do is spin
@Sillmjolke1g
@Sillmjolke1g 4 жыл бұрын
If the Jump button don't work make sure that: 1: PlayerMovement Script "Ground Mask" is set to Ground 2: GroundCheck is a bit bellow the character :D
@justkaveen
@justkaveen 4 жыл бұрын
Thanks :)
@Aitoritoast
@Aitoritoast 4 жыл бұрын
Omg it worked! Thank you Thank you Thank you
@ahmadhussain309
@ahmadhussain309 4 жыл бұрын
it didn't work for me. :(
@derdaxxdaxx489
@derdaxxdaxx489 4 жыл бұрын
@@ahmadhussain309 hey if it not works look if ur ground does have the layer Ground if not set it to layer ground 20:17 he sais we will fall normal but it means if the gravity is resetting at touching the ground (with the layer Ground) jump will also work
@-_wanderer
@-_wanderer 4 жыл бұрын
Thanks
@LaithGhandour-iz2ps
@LaithGhandour-iz2ps 6 ай бұрын
literally worked perfect first try and everything makes sense, you got me excited for my upcoming physics class
@lynxlagoon
@lynxlagoon 5 жыл бұрын
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 5 жыл бұрын
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 5 жыл бұрын
@@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 5 жыл бұрын
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 5 жыл бұрын
@@MuttleyGames Cinemachine? From looking at the pictures a few months ago i thought it was only for cinematics or cut scenes
@MuttleyGames
@MuttleyGames 5 жыл бұрын
@@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.
@TheCivildecay
@TheCivildecay 5 жыл бұрын
NOICE! Just when I was thinking "Hmm making all these 2D projects is getting stale, would like to do a first person game for once.."
@suspense_comix3237
@suspense_comix3237 4 жыл бұрын
I spent 30 minutes on trying to get the camera to rotate when I figured out I needed to save my code. I D I O T LOL
@aravind.s1187
@aravind.s1187 4 жыл бұрын
lool
@greenappleplaysroblox1661
@greenappleplaysroblox1661 4 жыл бұрын
How do you save it
@suspense_comix3237
@suspense_comix3237 4 жыл бұрын
@@greenappleplaysroblox1661 Ctrl + S
@greenappleplaysroblox1661
@greenappleplaysroblox1661 4 жыл бұрын
Suspense_Comix thank you
@aravind.s1187
@aravind.s1187 4 жыл бұрын
@@greenappleplaysroblox1661 lol
@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!
@kajunia6960
@kajunia6960 4 жыл бұрын
Brackeys: And that should be it for our basic movement. If we now save this, and go back to Unity- Me: We get a bunch of errors and lose all hope!
@tealsheepproductions7431
@tealsheepproductions7431 4 жыл бұрын
me too
@natharon
@natharon 4 жыл бұрын
lmao yes
@coffeeandpie1480
@coffeeandpie1480 4 жыл бұрын
yes
@discodude917
@discodude917 4 жыл бұрын
you gotta save the project
@bigmantunes
@bigmantunes 4 жыл бұрын
so true
@codyomeara
@codyomeara 3 жыл бұрын
If you are having trouble jumping, I would recommend removing "&& isGrounded" from your if statement when you press "Jump". If you can now Jump, this mean something is wrong with your GroundCheck object. It is critical to get that to fix because now you would be able to spam jump and go as high up. if(Input.GetButtonDown("Jump")) { velocity.y = Mathf.Sqrt(jumpHeight * -2f * gravity); }
@boozesnooze4243
@boozesnooze4243 3 жыл бұрын
Thank you so much, you saved me a couple of hours
@User74773
@User74773 3 жыл бұрын
Thank you so much bro, do you know how to fix my ground check object? what do i have to do to fix it? Thanks!
@plutoniumtoe
@plutoniumtoe 3 жыл бұрын
@@User74773 did you actually move the object below the player? thats what i did wrong and now it works
@rowanchuck5550
@rowanchuck5550 3 жыл бұрын
@@User74773 Im having the same problem I dont know what to do
@bomdias7110
@bomdias7110 3 жыл бұрын
U R GOD MAN THX
@sleetyhurdle300
@sleetyhurdle300 5 жыл бұрын
Me: When you try your best to make your first game and you succeed because Brackeys is awesome
@kofuu0171
@kofuu0171 5 жыл бұрын
It’s not working
@sleetyhurdle300
@sleetyhurdle300 5 жыл бұрын
@@kofuu0171 :( for i it did sry
@flatearther5712
@flatearther5712 4 жыл бұрын
big mood
@crimsonowlz942
@crimsonowlz942 4 жыл бұрын
What coding software did you use?
@sleetyhurdle300
@sleetyhurdle300 4 жыл бұрын
@@crimsonowlz942 I used Visual Studio
@gaurang3586
@gaurang3586 2 жыл бұрын
YOUR ASSETS ARE AWESOME JUST LIKE YOUR TUTORIALS
@thesixstistari5604
@thesixstistari5604 3 жыл бұрын
Every time he says "it's actually really simple" he just feels like unityes Mumbo-jumbo With the difference that I am good at Redstone, but my programming knowledge is less then 0
@cubecraftgaming9669
@cubecraftgaming9669 3 жыл бұрын
Same with me, but I'm good at programing but trash at redstone
@owleyed5038
@owleyed5038 3 жыл бұрын
(Not so) Same problem here trash at both like I know nothing.
@chilfghfh1949
@chilfghfh1949 3 жыл бұрын
@@owleyed5038 Ah it seems I have found my twin.
@lakshyakumar4459
@lakshyakumar4459 3 жыл бұрын
yeah Brackeys in Codin = MubmoJumbo in Redstone (Ablolute gods)
@AntrixxFE2
@AntrixxFE2 3 жыл бұрын
im trash at redstone, and im trash at programming.
@gokhon_
@gokhon_ 4 жыл бұрын
My soul has left my body 8 minutes in
@harunisjohn3783
@harunisjohn3783 4 жыл бұрын
This comment is underrated :D :D
@thefogel6049
@thefogel6049 4 жыл бұрын
If in the mouse movement part you had an error like this: "ArguementException: Input Axis MouseX is not setup." For me the solution was to go to Edit >> Project settings.... >> Input Manager: Mouse X - change the Name to "MouseX" instead of "Mouse X"(*note the space) and the same thing in Mouse Y. Glad to help
@thatscool939
@thatscool939 4 жыл бұрын
thx you helped me so much! -President Obama
@roscora614
@roscora614 4 жыл бұрын
it didnt work
@undefinedchannel9916
@undefinedchannel9916 4 жыл бұрын
@@roscora614 this is stupid just change the variable to "Mouse X" USE THE SPACE. Don't change your project setup just because you misspelled something.
@thefogel6049
@thefogel6049 4 жыл бұрын
@@undefinedchannel9916 you can't, it will give you an error massage....
@undefinedchannel9916
@undefinedchannel9916 4 жыл бұрын
@@thefogel6049 float mouseX = Input.GetAxis("Mouse X"); float mouseY = Input.GetAxis("Mouse Y"); copy & paste it and tell me if you get an error
@resourcerods
@resourcerods Жыл бұрын
The video we've all needed at one point
@aswd45-mk14
@aswd45-mk14 4 жыл бұрын
For anyone having trubble with jumping: 1- Try repositionning the grund checker; 2-Increse the radius of theground checker. In changed mine to 0.7f instead of 0.4f and is work!
@Inuitman
@Inuitman 4 жыл бұрын
Thanks a fucking lot dude, you saved me in my trying times.
@problemchild959
@problemchild959 4 жыл бұрын
or try getting rid of the un needed ground checker he used and use the built in check that the character controller has. it already has a built in ground check. see: docs.unity3d.com/ScriptReference/CharacterController-isGrounded.html
@summonerdestroyer6965
@summonerdestroyer6965 4 жыл бұрын
It's just saying input doesnt have a definition for isGrounded
@Imstupid-ni3we
@Imstupid-ni3we 4 жыл бұрын
GOD BLESS YOU!
@Alechs777
@Alechs777 4 жыл бұрын
Thank you!
@floris_5699
@floris_5699 3 жыл бұрын
For people that are stuck on 20:17 that is because VS gives an error at groundDistance. Replace that with: public float groundDistance; . then set groundDistance on 0,4 in unity. I hope it is fixed.
@danjal69
@danjal69 3 жыл бұрын
I can only look up and down not to the sides help my code 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); } }
@yodelingtornado3389
@yodelingtornado3389 3 жыл бұрын
Can you put your code in for example? and do i still set the layering as ground or no? here's my code and if its wrong can tell me? 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 Transform groundCheck; public float groundDistance = 0.4f; public LayerMask groundMask; Vector3 velocity; bool isGrounded; private float floatgroundDistance; // Update is called once per frame void Update() { isGrounded = Physics.CheckSphere(groundCheck.position, floatgroundDistance, groundMask); if(isGrounded && velocity.y
@shadbh2
@shadbh2 2 жыл бұрын
@@danjal69 you forgot the semicolon in "xRotation = Mathf.Clamp(xRotation, -90f, 90f)"
@sidice123
@sidice123 2 жыл бұрын
@@danjal69 same
@AdeebPlayz
@AdeebPlayz 2 жыл бұрын
Can you put the Code in the Comments? I have tried alot of things but didn't Succed....
@jamado9067
@jamado9067 3 жыл бұрын
btw, you can press the following to stop / start play testing Windows: Ctrl + P Mac: Command + P
@RiftCuber01
@RiftCuber01 2 жыл бұрын
Really concise, this is the best fps programming tutorial I have seen so far!
@darkwoodmovies
@darkwoodmovies 3 жыл бұрын
I'm really surprised something as common as a first-person character isn't just built into Unity. This seems like way too much manual setup for something so useful.
@supreme-doggo9680
@supreme-doggo9680 3 жыл бұрын
technicly you could yoink code from fps microgame
@dire284
@dire284 3 жыл бұрын
If you aren't willing to spend like 5 minutes writing a simple controller then idk if programing is for you man.
@darkwoodmovies
@darkwoodmovies 3 жыл бұрын
@@dire284 That's a really dumb argument.... by that logic, if you use code autocomplete, maybe programming isn't for you? Like wtf kind of a statement is that, just for not wanting to do busy work. This kind of stuff is literally the reason libraries and frameworks get created.
@dire284
@dire284 3 жыл бұрын
@@darkwoodmovies I'm saying, why is it too much manual work when you're already using the built in character controller and all you're doing is specifying the the bare minimum to get it going.
@dire284
@dire284 3 жыл бұрын
@@darkwoodmovies And to scratchybears point, it already exists in the form of an official asset package. Unity doesn't need to add these things to the engine as they cause unnecessary bloat for the like 5 minutes of work they save.
@wackyanimations3326
@wackyanimations3326 4 жыл бұрын
"If we are currently grounded" "Mom, I'm not grounded, right?" "Yes, honey." "SO I CAN CLIP TO THE FLOOR!?!"
@garlicbread1575
@garlicbread1575 4 жыл бұрын
no that means that you can float off your bed
@Ultra7896
@Ultra7896 3 жыл бұрын
This really helped me start 3d game development!
@aleksiszaps8423
@aleksiszaps8423 2 жыл бұрын
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
@CoCthPlain
@CoCthPlain 3 жыл бұрын
You know what, I'm a fool. I spent way too much time trying to figure out what I did wrong until I realized that I hadn't linked the player body... Thanks again for the great tutorials..! :D
@willowail
@willowail 3 жыл бұрын
How do you link the player body ?
@CoCthPlain
@CoCthPlain 3 жыл бұрын
@@willowail I forgot to link my logic to the player body as shown in 8:10 of this video. So just drag your logic into the space next to the Player Body in the Main Camera. I hope this helps.
@michaelservis9251
@michaelservis9251 3 жыл бұрын
@@CoCthPlain the thing there is no player body for me so I don't know what I've done 😭😭🤣
@CoCthPlain
@CoCthPlain 3 жыл бұрын
@@michaelservis9251 All I can say is look at the code again and check if you got it right. Sorry, this isn't very useful.
@vfwarlordforever9589
@vfwarlordforever9589 3 жыл бұрын
@@michaelservis9251 Sometimes Brackeys goes kind of fast so you might miss a step. Rewatch anything you didn't follow. Basically Player body is a just a Game object you created. You create the game object, you make it a cylinder, and lastly you simply name it" player Body" It is player body because you designated it as such. If you want to make an enemy character, make another Game object in Hierarchy, make it whatever shape you'd like, and rename it Enemy Body to designate it as an enemy character. I hope that helps.
@imaUFO672
@imaUFO672 5 жыл бұрын
Just when i needed a tutorial like this, you’re a life saver!
@andrews4208
@andrews4208 5 жыл бұрын
i cant place closed brackets, how did you do it
@CubexCodes
@CubexCodes 3 жыл бұрын
These are so bad days that we can't see his tutorial anymore because he quit. I wish he will be success in his future! :)
@sayed1302
@sayed1302 3 жыл бұрын
i see your videos
@axsplayz5173
@axsplayz5173 3 жыл бұрын
I am beluga
@kaclifs8199
@kaclifs8199 2 жыл бұрын
i'm a beginer dev and i watch our videos and i realy evolute.detail 12 years
@linckza186
@linckza186 3 жыл бұрын
This is the best tutorial out there, I had 0 problems other than typos I made in the script. Thank you!
@mrgibus8278
@mrgibus8278 3 жыл бұрын
Me: sees this Also me: impossible. Perhaps the archives are incomplete
@1hr399
@1hr399 3 жыл бұрын
Hey, when i try to refrence character controller into the player movement script In inspector ( 14:13 ) It wont let me. What am I Doing wrong?
@kiminari9921
@kiminari9921 4 жыл бұрын
Pro tip: You can add the jump code from this to the third person character controller. Works great. Just take out the jump script and gravity from out of the if (direction.magnitude >= .1f) clause.
@deinemum2750
@deinemum2750 3 жыл бұрын
thx dude :3
@TheCrabActivist4525
@TheCrabActivist4525 2 жыл бұрын
You are a wonderful individual, thank you for this.
@GrzybeQ
@GrzybeQ 2 жыл бұрын
XD ty
@DravenothTheSecond
@DravenothTheSecond 4 жыл бұрын
For player movement just incase using UnityEngine; public class PlayerMovement : MonoBehaviour { public CharacterController controller; public float speed = 12f; public float gravity = -9.81f; public float jumpHeight = 3.5f; 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 * -2 * gravity); } velocity.y += gravity * Time.deltaTime; controller.Move(velocity * Time.deltaTime); } }
@troyhinson1580
@troyhinson1580 2 жыл бұрын
thanks
@AndyGun11
@AndyGun11 2 жыл бұрын
Thank you Brackeys! I just started Unity, and these tutorials are amazing! :DD
@McCrazyDude950
@McCrazyDude950 2 жыл бұрын
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 2 жыл бұрын
if it did, please tell me what i couldve done wrong
@AndyGun11
@AndyGun11 2 жыл бұрын
@@McCrazyDude950 uh.. My best advice here is to just restart the tutorial.
@SwagWizard555
@SwagWizard555 4 жыл бұрын
error CS0103: The name 'velocity' does not exist in the current context I forgot the vector3. edit: It took me so long to find that and I just felt like commenting it. Thanks for the likes btw
@noaml1326
@noaml1326 4 жыл бұрын
lol
@elomealex
@elomealex 4 жыл бұрын
I dont know why, but when i editet the jump in and saved these two errors showed up: "error CS0101: The namespace '' already contains a definition for 'PlayerMovement'" and "error CS0111: Type 'PlayerMovement' already defines a member called 'Update' with the same parameter types" does anyone knows why?
@usamabinmuzaffar692
@usamabinmuzaffar692 2 жыл бұрын
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
@PaulaoVT1
@PaulaoVT1 2 жыл бұрын
Ok, but how i can disable that script?
@usamabinmuzaffar692
@usamabinmuzaffar692 2 жыл бұрын
@@PaulaoVT1 right click on the scrip and remove the component.
@GlitchGBG
@GlitchGBG 2 жыл бұрын
i dont see the component so i cant delete it ):
@IIStaffyII
@IIStaffyII 5 жыл бұрын
Awsome video Brackeys. There is however a small problem with the movement. You should normalize the vector move before multiplying with speed. The length of the vector forward + right will be longer than the vector forward or right. If not your character will have a faster diagonal speed.
@DreadKyller
@DreadKyller 5 жыл бұрын
Yeah, when moving on one axis your speed will be exactly the speed, when moving on two axis at that speed your velocity will be sqrt(2) * that speed. In many early FPS games and still even today this is not uncommon, you can still find modern games with this "issue" Although most players will usually not notice it it can actually be a mechanic that raises the skill ceiling a bit for people that look more in depth to the quirks of the game in order to give them a boost in their skill. Therefore for some games or for some developers it may be desirable to have this quirk in intentionally instead of removing it.
@Futureblur
@Futureblur 5 жыл бұрын
THAAAAAANK YOUU I SEARCHED HOURS FOR THIS ISSUE THAAANKS BROO
@dormix1376
@dormix1376 4 жыл бұрын
I did it but my character stops after a while and that makes the movement even worse, how can I fix it?
@IIStaffyII
@IIStaffyII 4 жыл бұрын
@@dormix1376 Make sure u only normalize before applying the speed multiplier
@napoleon384
@napoleon384 2 жыл бұрын
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
MAKE AN RPG WITHOUT CODE - Unity Creator Kit
24:18
Brackeys
Рет қаралды 472 М.
1ST AND 3RD PERSON CONTROLLER - COMPLETE COURSE
26:11
spaderdabomb
Рет қаралды 20 М.
BAYGUYSTAN | 1 СЕРИЯ | bayGUYS
36:55
bayGUYS
Рет қаралды 1,9 МЛН
How To Spawn Enemies In Unity
5:55
Gatsby
Рет қаралды 152
THIRD PERSON MOVEMENT in Unity
21:05
Brackeys
Рет қаралды 1,5 МЛН
Can I remake those SH*TTY mobile games in 1 HOUR?
23:13
Code Bullet
Рет қаралды 2,9 МЛН
How to make The Best First Person Camera in Unity
9:04
semikoder
Рет қаралды 24 М.
So I made every block act differently..
11:41
Element X
Рет қаралды 310 М.
Optimizing my Game so it Runs on a Potato
19:02
Blargis
Рет қаралды 685 М.
7 DEVS Make a GAME without COMMUNICATING! (centipede edition)
17:16
Blackthornprod
Рет қаралды 1,2 МЛН
HOW TO GAME JAM!
9:01
Brackeys
Рет қаралды 284 М.
First Person Movement in Unity 2024 - FPS Controller Tutorial
23:07
GarrettDeveloper
Рет қаралды 8 М.