4 years in and this is one of the best movement tutorial that I found out there
@Iwan._6 ай бұрын
I found it once and use it every time till today
@vario1305Ай бұрын
@@Iwan._ Same man but i stoped game dev went to unreal came back to unity because i cant run unreal.
@redliam55 жыл бұрын
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.
@zerogaminghq54305 жыл бұрын
Similar! I think huh what if bracket did first per- New video 🤔
@thellamawaffle68175 жыл бұрын
yeah! what is up with that..?
@Gamer-uf1kl5 жыл бұрын
I am new here so the most types of game i make are here
@catacylist29334 жыл бұрын
What if brackets did a mech game tutorial
@test_121254 жыл бұрын
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
@whugnong4 жыл бұрын
me: trying to slowly and methodically type out a script. brackeys: I AM SPEED.
@StarzzDrak4 жыл бұрын
bruh i have the same problem except i need to set video speed to 1.25 :D
@stupidrobot78964 жыл бұрын
StarzzDrak good for you but.... we didn’t need to know that
@StarzzDrak4 жыл бұрын
@@stupidrobot7896 yes but its life struggle for both of us.. that was the point
@SwedishVikingMC4 жыл бұрын
@@StarzzDrak Why are you watching a beginner tutorial if you're a more experienced programmer? lol
@StarzzDrak4 жыл бұрын
@@SwedishVikingMCbruh why not ? I haven't created a single 3d character controller in 3 years
@SrStakeholder5 жыл бұрын
I heard that Bethesda offices doesn’t have doors, the staff just clip trough the walls.
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 Жыл бұрын
Exactly the same here!
@FYFTYNDIGITSLoF9 ай бұрын
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
@letthatbe7 ай бұрын
But you have given up right? :D
@FYFTYNDIGITSLoF7 ай бұрын
@@letthatbe nope
@pumpkinpyewastaken6 ай бұрын
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"
@zacoriot4 жыл бұрын
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-hf6os1qb2w4 жыл бұрын
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
@bobdagamer6404 жыл бұрын
Alt + f4 I believe is good
@yeahnope23494 жыл бұрын
@@bobdagamer640 For a split second, i went "Huh I didn't know they could do tha-- wait a second...
@bobdagamer6404 жыл бұрын
Lol
@Kortenue4 жыл бұрын
I forgot a comma when that almost happened
@labscience82713 жыл бұрын
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 :(
@Boogaloo693 жыл бұрын
Same bro :(
@frostblock_123 жыл бұрын
thanks my dude
@MMithy3 жыл бұрын
@@Boogaloo69 same :(
@yourmum69_4203 жыл бұрын
hey can anyone help me please? When I added controller support my camera spins around like crazy and I don't know why
@Bigmanjeff693 жыл бұрын
Thanks for this bro
@sykoo5 жыл бұрын
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!
@theonlyasher4 жыл бұрын
Sykooooooooooooooooooo
@thecomputez-gaming84274 жыл бұрын
@AlanTheGamerWolf wdym sykoo is lit
@age95024 жыл бұрын
Only 3 comment
@iantakacs87713 жыл бұрын
mmmm moss cake
@jeremiahruiz96863 жыл бұрын
the best level creator
@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 Жыл бұрын
Jesus is lord follow him and you will be saved
@Yoctopory Жыл бұрын
@@amanewithjesus What's wrong with you?
@viola_case3 жыл бұрын
Brackeys tutorials will always be my go-to because his smile makes me feel welcome and ready to learn.
@josephjohn92153 жыл бұрын
my camera is not rotating instead player is moving in the x axis when i move the mouse, what do i do
@viola_case3 жыл бұрын
@@josephjohn9215 I think you meant to put this in the main video thread? I don't know how to fix your problem.
@josephjohn92153 жыл бұрын
@@viola_case thank you, but someone else helped me
@Couldbeme3 жыл бұрын
@@josephjohn9215 what'd they say
@josephjohn92153 жыл бұрын
@@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 )
@Yoctopory3 жыл бұрын
God creating the universe: "..and of course let's multiply with Time.deltaTime".
@marshgd3 жыл бұрын
lol
@vaglo7013 жыл бұрын
underrated xd
@otsvtsu7i3 жыл бұрын
HAHAHAHA
@Aries-tp8sk3 жыл бұрын
69th like
@Yoctopory3 жыл бұрын
@@Aries-tp8sk nice ;)
@thewatermelon_thing70833 жыл бұрын
Unity: "No errors detected!" Me: Falling through the ground at 5000 miles per hour.
@p4tk473 жыл бұрын
Unity: "No Errors detected" Me: Jump, no :(
@leonardpertsch87843 жыл бұрын
@@p4tk47 same. did you fix it?
@hamoodibtw55503 жыл бұрын
how to fix?
@skphotography69823 жыл бұрын
@@p4tk47 SAME
@francomarini63113 жыл бұрын
do you have a terrain or a plane with a collider on it?
@arkilusreal2 жыл бұрын
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
@etannn2 жыл бұрын
Thanks bro
@arkilusreal2 жыл бұрын
@@etannn no probs
@DiegoValenciabajista2 жыл бұрын
Ey bro, my cursor is still visible even tho I put the Cursor code at the start void. Do you know why?
@arkilusreal2 жыл бұрын
im so sorry dude i watched this like a month ago so i have no idea lol. But ill try to find out why
@DiegoValenciabajista2 жыл бұрын
@@arkilusreal its ok, actually I figure it out. Thank you very much for responding!
@casssaph22874 жыл бұрын
me: sees "quaternion" me: "ok so basically its black magic and i dont need to know how it works"
@youneskasdi4 жыл бұрын
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
@dzvidea50654 жыл бұрын
@@youneskasdi i did an oopsie... i dug into it you weren't wrong, my head hurts
@scorpoinlol974 жыл бұрын
@@dzvidea5065 same here
@thealgomanxr4 жыл бұрын
@@youneskasdi I read an article about it and understand absolutely nothing
@copperwires96634 жыл бұрын
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
@kingkodo71845 жыл бұрын
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.
@Brackeys5 жыл бұрын
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!
@tamaskisely5 жыл бұрын
Could somebody please be more specific? ( I mean explain this in a more detailed way) Thanks
@equation13215 жыл бұрын
Hello
@llakuawyus73265 жыл бұрын
@@tamaskisely Yeah a bit more detail would help a lot lol.
@TheCivildecay5 жыл бұрын
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)
@susseratal4 жыл бұрын
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
@Lumiobyte4 жыл бұрын
@@speedyturtle1537 why are you spamming that everywhere
@CreativeUsernameHere-r1k4 жыл бұрын
Idk... they have much bigger problems... like they aren't even using an engine comparable to unity... it's more comparable to quake ...
@jamieboer34664 жыл бұрын
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-r1k4 жыл бұрын
@@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-ke9lq2 жыл бұрын
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
@fearedwolf17312 жыл бұрын
Brackeys I almost quit watching you becuase I thought unity cost money but now im back and realised your my best source of knowlage.
@basilbravo63613 жыл бұрын
me: types the code and follows each step carefully. unity: 249 errors take it or leave it.
@Mr-px4nz3 жыл бұрын
I also have such a problem. Can anyone help with that? :(
@tverroryt3 жыл бұрын
@Liftnop i have so much erors
@sembos11513 жыл бұрын
@@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); } }
@youtubespyder43893 жыл бұрын
dude thats something thats weird
@arandomeditor9723 жыл бұрын
Pls help I followed all the steps but it says file missing when I try to add movement
@LegndGames_YT4 жыл бұрын
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!
@pepijnvb14844 жыл бұрын
Thanks for the tip, it removed the stuttering for me!
@LegndGames_YT4 жыл бұрын
@@pepijnvb1484 No problem! Glad to help :)
@karter66324 жыл бұрын
@@LegndGames_YT how do i do this
@karter66324 жыл бұрын
@@LegndGames_YT how do i do this
@LegndGames_YT4 жыл бұрын
@@karter6632 Simply remove Time.deltaTime from the MouseLook script :)
@kieranwiggy25224 жыл бұрын
Everyone is back here since we are all in quarantine
@Dom43214 жыл бұрын
Hell Yeah
@unclerandy3984 жыл бұрын
yup
@voicehead4 жыл бұрын
oh yeah
@julianeyt40594 жыл бұрын
after this is over we will have millions of new game developer XD
@aquah20804 жыл бұрын
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 Жыл бұрын
The Fact That I Learned 3D Movement Script. YOU ARE JUST AWESOME
@xrotator89864 жыл бұрын
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
@CodexCornerGames4 жыл бұрын
Can anyone help me?Whenever I press spacebar the player doesnt do anything.I can move and look around though.
@FaruukNN4 жыл бұрын
@@CodexCornerGames you should check your groundcheck :d
@bobsapdagger4 жыл бұрын
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.
@eeevoo4 жыл бұрын
couldn't have said it better
@marcusaddison88664 жыл бұрын
Out ranks all those satisfying video compilations on KZbin
@CodexCornerGames4 жыл бұрын
Can anyone help me? I have a problem where I cant jump even though I copied the exact code.
@eeevoo4 жыл бұрын
@@CodexCornerGames Did you assign the script to the player?
@CodexCornerGames4 жыл бұрын
@@eeevoo Yes.
@AlexandruAlexe073 жыл бұрын
me: I will do this by myself also me at 12 am: Brackeys tutorial fps movement
@labscience82713 жыл бұрын
Hahahha same. I'm a noob. I can't do it without Brackeys
@cubecraftgaming96693 жыл бұрын
@@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! 😁
@pugwilldestroygaming97692 жыл бұрын
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
@everydayisntnormal69452 жыл бұрын
wow
@IamDrDapper2 жыл бұрын
Genius
@BreadAckerman Жыл бұрын
God damn it he must not live he possesses the "i will improvise" strategy.
@no80534 жыл бұрын
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
@meeblesneeble3 жыл бұрын
If anyone is having issues with the line involving "MathF", its "Mathf" now. Hope this helps!
@alexbrooks1283 жыл бұрын
@nostalgia television just tryna help bro chill
@alephcake3 жыл бұрын
That one Unity programmer that changed MathF to Mathf and earned 1000$ for it
@psytf22 жыл бұрын
@nostalgia television sounds like you're trying to sound smart
@ScrollNTold4 жыл бұрын
me: following every step he makes The Word/letter color: is different me: there's something wrong I can feel it
@mage36904 жыл бұрын
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.
@nevetsmahgnirtle89614 жыл бұрын
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_124 жыл бұрын
imagine A third-person game, but it's a first-person game
@isaacsworld11774 жыл бұрын
😒
@oscarfacecamplz82644 жыл бұрын
If it in color. What happens I’m new to Unity please help me it says when I hit play remove the compiler errors.
@hmmmmm87162 жыл бұрын
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!!!!
@SyncroxDeeznuts2 жыл бұрын
Make sure you add the camera as a child object to the player
@vasatruhl2 жыл бұрын
Brackeys is a life saver :D
@BishalKhan015 жыл бұрын
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!!!
@speedyturtle15374 жыл бұрын
It would be great to have you on the team!! discord.gg/KpHx7Fj
@nietzsche143 жыл бұрын
Me acting like I understand and am not just copying everything he is doing. "mhmmmm"
@davez27963 жыл бұрын
hhahhahah same
@sillymortalz3 жыл бұрын
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?
@cubecraftgaming96693 жыл бұрын
@@sillymortalz Same XD
@lakshyakumar44593 жыл бұрын
please help my code isnt working
@lakshyakumar44593 жыл бұрын
if once i added the ycode for it to move p and down only that worked it stopped looking aroud i reallycant explain
@iilliot4 жыл бұрын
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.
@frindjinny64 жыл бұрын
where do i pu tthe comma it wants me to put a comma WHERE IS IT AAAAAAAAAA
@snoutgames49404 жыл бұрын
i've done that so much lol
@TinyDeskEngineer4 жыл бұрын
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_4 жыл бұрын
ctrl s am i joke to you
@thewindowgames26104 жыл бұрын
Dang, I hate when that happens
@mesopithecus86222 жыл бұрын
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-er3kw8hv7i2 жыл бұрын
whats the key for left shift?
@mesopithecus86222 жыл бұрын
@@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_N00B2 жыл бұрын
@@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.
@NotMrLex2 жыл бұрын
thank you very kind stranger.
@sohodollie76432 жыл бұрын
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
@maxdukhovskoy14064 жыл бұрын
Me: "ok, I copied this perfectly, it should work..." Unity: nah, we don't do that here.
@kanesiajones44074 жыл бұрын
Use 2019.4 either that or your a lire
@azzy12204 жыл бұрын
@@kanesiajones4407 r/woooosh
@FunnyTypeChi4 жыл бұрын
@@kanesiajones4407 r/woooosh
@jihannireshwalia76034 жыл бұрын
@@kanesiajones4407 r/woooosh
@whoisthisuserthough4 жыл бұрын
@@kanesiajones4407 r/woooosh
@datblue11044 жыл бұрын
Brackeys: "And now we should be able to move around" My Character: " *_YEET gdf bngrsdts ytnw eaygfdfgbv_* "
@eddybplayz48014 жыл бұрын
@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
@aheavyofculture4 жыл бұрын
@DRAGO YT GAMING Why do you use a capital at the start of every word?
@nutellacheese60174 жыл бұрын
Lolol
@user-ji3tc7ut8k4 жыл бұрын
@@aheavyofculture C# is cap sensitive
@aheavyofculture4 жыл бұрын
@@user-ji3tc7ut8k so?
@MathRavn4 жыл бұрын
This is the most relatable comment section I've ever seen
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 😊
@jmdbeans2 жыл бұрын
sorry it didnt work for me
@raffe78894 жыл бұрын
I can't believe Brackeys is gone ;_; Their content is still amazing though and they made A LOT of it
@TheCorruptClown325184 жыл бұрын
Wut happened
@DemonPig6664 жыл бұрын
😭😭
@FuzzyWeasel4 жыл бұрын
I know.its sad. But I think codeMonkey still makes videos. You could check him out
@emirhansoyluBF3 жыл бұрын
I'm still crying :''''(((((
@faisalalodat90373 жыл бұрын
:(
@tres-2b2993 жыл бұрын
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!
@connorkerrigan35825 жыл бұрын
i laughed so hard when my guy slowly started floating up into the sky
@rexss905 жыл бұрын
i have the same problem, can't seem to get the guy on the ground. He either shoots sideways extremely fast or floats
@nautics99275 жыл бұрын
@@rexss90 go into your player and make sure the gravity is negative
@rexss905 жыл бұрын
@@nautics9927 Thanks, i figured it out finally!
@CrazyJoven4 жыл бұрын
@@nautics9927 THANK YOU!!
@nautics99274 жыл бұрын
@@CrazyJoven no problem
@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!
@fabiosfree4 жыл бұрын
Me: Copies perfectly Unity: 964 ERRORS
@aravind.s11874 жыл бұрын
LOL
@TKTC_The_Key4 жыл бұрын
Only?
@fabiosfree4 жыл бұрын
@@TKTC_The_Key Yea!. Im just good like that.
@faynon87654 жыл бұрын
you forget the dot '-'
@tfeak21014 жыл бұрын
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.
@nicolaicardinale79023 жыл бұрын
It's 2021 and this video is still a GODSEND. thank you so much for not just good instructions but clear ones.
@davidmcasas4 жыл бұрын
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.
@aresstavropoulos9164 жыл бұрын
Damn I love u I was about to give up and saw your comment.
@kyledunbar92554 жыл бұрын
you legend. came back to the comments just to see if anyone had a fix for this
@blasfah19094 жыл бұрын
vertical velocity does not exist in the current context
@davidmcasas4 жыл бұрын
@@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-qf6kz4 жыл бұрын
@@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; } }
@fluberdebluber75667 ай бұрын
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!
@talion92893 жыл бұрын
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
@dcry10033 жыл бұрын
Hey mate just asking how can i can i turn this fps script into a mobile controller? Using UI Buttons?
@noobyeeter2 жыл бұрын
LETS GOOOOO! someone plays titanfall!
@bagger14512 жыл бұрын
Me: Copys his code perfectly Unity: 341 Errors Me: Adds 1 letter Unity: Perfect.
@lcj3_2 жыл бұрын
fax man me: **Forgets to put a semicolon** Unity: This semicolon will ruin your life now.
@Ikaros-fo5cb2 жыл бұрын
for some reason the script for the mouselook doesn't work on my "game" what do i do?
@FelineRaptor-gv4te2 жыл бұрын
@@lcj3_ but your IDE will point out where you missed the semi colon
@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_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
@RichAndDianaWilliams3 жыл бұрын
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 Жыл бұрын
The best general unity player movement tutorial on youtube!
@MidasClutch3 жыл бұрын
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*
@holliscf3 жыл бұрын
Space in btw mouse and Y?
@learnenglishinhouse31023 жыл бұрын
error because the space, is "Mouse Y"
@sohamacharya1713 жыл бұрын
A catch 22 situation.
@fillament3 жыл бұрын
That happens too much.
@sylinder__26333 жыл бұрын
personally it says i have to setup mouse x but i dont know how to do it
@henrylawrence85624 жыл бұрын
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.
@equation13214 жыл бұрын
Henry Lawrence thnx
@georgebooth64414 жыл бұрын
Me: Gravity doesn't work. Me: "Alright I'll continue in about 3 years,"
@tinsku332Xd4 жыл бұрын
@Torben Kauth it worked for me
@jayjayjay-er9ex4 жыл бұрын
@@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?
@tinsku332Xd4 жыл бұрын
@@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-er9ex4 жыл бұрын
@@tinsku332Xd thank you sososososososososo much
@jayjayjay-er9ex4 жыл бұрын
@@tinsku332Xd i copied and pasted your code but no luck. same as before :(
@kapex64052 жыл бұрын
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); } }
@Termosulboreas2 жыл бұрын
legend
@Termosulboreas2 жыл бұрын
@Trupnup [GD] some heroes don't wear capes
@Pepagg82 жыл бұрын
this script makes the entire character look down not just the camera thus moving the groundcheck so you cant jump when looking down
@Termosulboreas2 жыл бұрын
@@Pepagg8 not important
@volk43422 жыл бұрын
If you wanna learn don’t copy this
@boysminecraftianos4694 жыл бұрын
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
@talibalasrar4 жыл бұрын
Everyone copies code at first you will learn gradually over time
@davidfails28664 жыл бұрын
Haha... Explain them to me im too lazy to look them up
@linshu61414 жыл бұрын
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.
@itzyuzuruclips4 жыл бұрын
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
@icantthinkofaname27224 жыл бұрын
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).
@TheAmazingPyro993 жыл бұрын
me: copys all of the code perfectly unity: ERROR also me: changes from a capitalised T to an normal t Unity: no errors
@superlative_3 жыл бұрын
let me guess. transform and Transform?
@jangamer29713 жыл бұрын
Lmao I was seraching for answers in comments to help me you were the one I just replaced the T with a t
@TheAmazingPyro993 жыл бұрын
@@jangamer2971 bruh
@Pre1ude03 жыл бұрын
I have the same problem
@Yoctopory3 жыл бұрын
So in fact you DIDN'T copy the code perfectly ;)
@jacobfenech76624 жыл бұрын
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.
@salemisjuucy4 жыл бұрын
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.4 жыл бұрын
same
@InsaneJumpscare4 жыл бұрын
@@salemisjuucy compiled errors
@NielsKnives4 жыл бұрын
I m 12 and i get it
@InsaneJumpscare4 жыл бұрын
N M video's but it still has errors, am I using the wrong coding app? I am using c# visual studio
@random_guy-rz8vz10 ай бұрын
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!
@zimistic66803 жыл бұрын
“Man coding is so easy and works every time!” -nobody on planet earth
@jacobjackson86193 жыл бұрын
if i hear anyone say this, i smack their face with the errors i got in the last 5 mins
@doge78313 жыл бұрын
I got 999+ errors in 5 minutes of coding.
@noamyairperelman8753 жыл бұрын
@@doge7831 me to
@ruddydd40853 жыл бұрын
truth :p
@shadybandit73 жыл бұрын
its actually ez and i didn't get any erro
@magicdragon37253 жыл бұрын
When you're like, "What's wrong, nothing is showing up" but you forgot to save.
@robloxreviewer-z6m3 жыл бұрын
Or when you forgot to put a semicolon at the end of a line of code
@thespeediestgonzales77043 жыл бұрын
@@robloxreviewer-z6m or when you accidentally write code after a semicolon and leave it there in addition to a semicolon at the end
@alphaa21823 жыл бұрын
@@thespeediestgonzales7704 Or when you forgetting the multiplication dash adjacent to the vector
@CottonCandySnake1013 жыл бұрын
THAT WAS MY ISSUE THANK YOU SO MUCH
@magicdragon37253 жыл бұрын
@@CottonCandySnake101 np
@breadnotseen42923 жыл бұрын
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; }
@MimsTwo3 жыл бұрын
Thanks!
@wolfster77763 жыл бұрын
Amazing it is working Tx
@poizan84603 жыл бұрын
you shouldn't add the && isGrounded, since sprinting make's you jump abit further ahead! Just saying though ;)
@wolfster77763 жыл бұрын
ohh
@jcdenton72733 жыл бұрын
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; } }
@haydenmcturk23292 жыл бұрын
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 Жыл бұрын
Thank you so much this helped a lot lol.
@Semmetje11lolly3 жыл бұрын
2:49 video starts here (for myself, because I'll be coming back here A LOT)
@thunderbear06playsstuff633 жыл бұрын
Well you could export the player as a package so that you can import it into more projects in the future
@thunderbear06playsstuff633 жыл бұрын
thats what im trying to do rn
@matthewsimpson7963 жыл бұрын
Thanks?
@timmy21r3 жыл бұрын
@@thunderbear06playsstuff63 How do you do that?
@thunderbear06playsstuff633 жыл бұрын
@@timmy21r This should be what your looking for docs.unity3d.com/Manual/AssetPackagesCreate.html hope that helps
@redspartan77723 жыл бұрын
There’s nothing better than that feeling when you complete some code and get no errors
@shard75723 жыл бұрын
Ah, yes that feeling when the stars align
@mrgibus82783 жыл бұрын
Sadly, for me that is a feeling I have yet to expirience
@goodgamershow65053 жыл бұрын
it's all cool and etc, but have you ever finally piss, after not being able to do it for several hours straight?
@sohamacharya1713 жыл бұрын
A worse thing is when you have no errors but it still doesn't work.
@ionutdaniel40593 жыл бұрын
I got no errors *Starts the game and tries to move camera* unity: best i can do is spin
@Sillmjolke1g4 жыл бұрын
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
@justkaveen4 жыл бұрын
Thanks :)
@Aitoritoast4 жыл бұрын
Omg it worked! Thank you Thank you Thank you
@ahmadhussain3094 жыл бұрын
it didn't work for me. :(
@derdaxxdaxx4894 жыл бұрын
@@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
@-_wanderer4 жыл бұрын
Thanks
@LaithGhandour-iz2ps6 ай бұрын
literally worked perfect first try and everything makes sense, you got me excited for my upcoming physics class
@lynxlagoon5 жыл бұрын
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
@MuttleyGames5 жыл бұрын
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.
@lynxlagoon5 жыл бұрын
@@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
@MuttleyGames5 жыл бұрын
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.
@lynxlagoon5 жыл бұрын
@@MuttleyGames Cinemachine? From looking at the pictures a few months ago i thought it was only for cinematics or cut scenes
@MuttleyGames5 жыл бұрын
@@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.
@TheCivildecay5 жыл бұрын
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_comix32374 жыл бұрын
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.s11874 жыл бұрын
lool
@greenappleplaysroblox16614 жыл бұрын
How do you save it
@suspense_comix32374 жыл бұрын
@@greenappleplaysroblox1661 Ctrl + S
@greenappleplaysroblox16614 жыл бұрын
Suspense_Comix thank you
@aravind.s11874 жыл бұрын
@@greenappleplaysroblox1661 lol
@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!
@kajunia69604 жыл бұрын
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!
@tealsheepproductions74314 жыл бұрын
me too
@natharon4 жыл бұрын
lmao yes
@coffeeandpie14804 жыл бұрын
yes
@discodude9174 жыл бұрын
you gotta save the project
@bigmantunes4 жыл бұрын
so true
@codyomeara3 жыл бұрын
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); }
@boozesnooze42433 жыл бұрын
Thank you so much, you saved me a couple of hours
@User747733 жыл бұрын
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!
@plutoniumtoe3 жыл бұрын
@@User74773 did you actually move the object below the player? thats what i did wrong and now it works
@rowanchuck55503 жыл бұрын
@@User74773 Im having the same problem I dont know what to do
@bomdias71103 жыл бұрын
U R GOD MAN THX
@sleetyhurdle3005 жыл бұрын
Me: When you try your best to make your first game and you succeed because Brackeys is awesome
@kofuu01715 жыл бұрын
It’s not working
@sleetyhurdle3005 жыл бұрын
@@kofuu0171 :( for i it did sry
@flatearther57124 жыл бұрын
big mood
@crimsonowlz9424 жыл бұрын
What coding software did you use?
@sleetyhurdle3004 жыл бұрын
@@crimsonowlz942 I used Visual Studio
@gaurang35862 жыл бұрын
YOUR ASSETS ARE AWESOME JUST LIKE YOUR TUTORIALS
@thesixstistari56043 жыл бұрын
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
@cubecraftgaming96693 жыл бұрын
Same with me, but I'm good at programing but trash at redstone
@owleyed50383 жыл бұрын
(Not so) Same problem here trash at both like I know nothing.
@chilfghfh19493 жыл бұрын
@@owleyed5038 Ah it seems I have found my twin.
@lakshyakumar44593 жыл бұрын
yeah Brackeys in Codin = MubmoJumbo in Redstone (Ablolute gods)
@AntrixxFE23 жыл бұрын
im trash at redstone, and im trash at programming.
@gokhon_4 жыл бұрын
My soul has left my body 8 minutes in
@harunisjohn37834 жыл бұрын
This comment is underrated :D :D
@thefogel60494 жыл бұрын
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
@thatscool9394 жыл бұрын
thx you helped me so much! -President Obama
@roscora6144 жыл бұрын
it didnt work
@undefinedchannel99164 жыл бұрын
@@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.
@thefogel60494 жыл бұрын
@@undefinedchannel9916 you can't, it will give you an error massage....
@undefinedchannel99164 жыл бұрын
@@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 Жыл бұрын
The video we've all needed at one point
@aswd45-mk144 жыл бұрын
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!
@Inuitman4 жыл бұрын
Thanks a fucking lot dude, you saved me in my trying times.
@problemchild9594 жыл бұрын
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
@summonerdestroyer69654 жыл бұрын
It's just saying input doesnt have a definition for isGrounded
@Imstupid-ni3we4 жыл бұрын
GOD BLESS YOU!
@Alechs7774 жыл бұрын
Thank you!
@floris_56993 жыл бұрын
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.
@danjal693 жыл бұрын
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); } }
@yodelingtornado33893 жыл бұрын
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
@shadbh22 жыл бұрын
@@danjal69 you forgot the semicolon in "xRotation = Mathf.Clamp(xRotation, -90f, 90f)"
@sidice1232 жыл бұрын
@@danjal69 same
@AdeebPlayz2 жыл бұрын
Can you put the Code in the Comments? I have tried alot of things but didn't Succed....
@jamado90673 жыл бұрын
btw, you can press the following to stop / start play testing Windows: Ctrl + P Mac: Command + P
@RiftCuber012 жыл бұрын
Really concise, this is the best fps programming tutorial I have seen so far!
@darkwoodmovies3 жыл бұрын
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-doggo96803 жыл бұрын
technicly you could yoink code from fps microgame
@dire2843 жыл бұрын
If you aren't willing to spend like 5 minutes writing a simple controller then idk if programing is for you man.
@darkwoodmovies3 жыл бұрын
@@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.
@dire2843 жыл бұрын
@@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.
@dire2843 жыл бұрын
@@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.
@wackyanimations33264 жыл бұрын
"If we are currently grounded" "Mom, I'm not grounded, right?" "Yes, honey." "SO I CAN CLIP TO THE FLOOR!?!"
@garlicbread15754 жыл бұрын
no that means that you can float off your bed
@Ultra78963 жыл бұрын
This really helped me start 3d game development!
@aleksiszaps84232 жыл бұрын
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
@CoCthPlain3 жыл бұрын
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
@willowail3 жыл бұрын
How do you link the player body ?
@CoCthPlain3 жыл бұрын
@@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.
@michaelservis92513 жыл бұрын
@@CoCthPlain the thing there is no player body for me so I don't know what I've done 😭😭🤣
@CoCthPlain3 жыл бұрын
@@michaelservis9251 All I can say is look at the code again and check if you got it right. Sorry, this isn't very useful.
@vfwarlordforever95893 жыл бұрын
@@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.
@imaUFO6725 жыл бұрын
Just when i needed a tutorial like this, you’re a life saver!
@andrews42085 жыл бұрын
i cant place closed brackets, how did you do it
@CubexCodes3 жыл бұрын
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! :)
@sayed13023 жыл бұрын
i see your videos
@axsplayz51733 жыл бұрын
I am beluga
@kaclifs81992 жыл бұрын
i'm a beginer dev and i watch our videos and i realy evolute.detail 12 years
@linckza1863 жыл бұрын
This is the best tutorial out there, I had 0 problems other than typos I made in the script. Thank you!
@mrgibus82783 жыл бұрын
Me: sees this Also me: impossible. Perhaps the archives are incomplete
@1hr3993 жыл бұрын
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?
@kiminari99214 жыл бұрын
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.
@deinemum27503 жыл бұрын
thx dude :3
@TheCrabActivist45252 жыл бұрын
You are a wonderful individual, thank you for this.
@GrzybeQ2 жыл бұрын
XD ty
@DravenothTheSecond4 жыл бұрын
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); } }
@troyhinson15802 жыл бұрын
thanks
@AndyGun112 жыл бұрын
Thank you Brackeys! I just started Unity, and these tutorials are amazing! :DD
@McCrazyDude9502 жыл бұрын
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?
@McCrazyDude9502 жыл бұрын
if it did, please tell me what i couldve done wrong
@AndyGun112 жыл бұрын
@@McCrazyDude950 uh.. My best advice here is to just restart the tutorial.
@SwagWizard5554 жыл бұрын
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
@noaml13264 жыл бұрын
lol
@elomealex4 жыл бұрын
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?
@usamabinmuzaffar6922 жыл бұрын
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
@shadow501pl2 жыл бұрын
its only in the universal render pipeline
@usamabinmuzaffar6922 жыл бұрын
@@shadow501pl yeah you're right. I made the same project in HDRP and this wasn't there. I'll update my comment
@PaulaoVT12 жыл бұрын
Ok, but how i can disable that script?
@usamabinmuzaffar6922 жыл бұрын
@@PaulaoVT1 right click on the scrip and remove the component.
@GlitchGBG2 жыл бұрын
i dont see the component so i cant delete it ):
@IIStaffyII5 жыл бұрын
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.
@DreadKyller5 жыл бұрын
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.
@Futureblur5 жыл бұрын
THAAAAAANK YOUU I SEARCHED HOURS FOR THIS ISSUE THAAANKS BROO
@dormix13764 жыл бұрын
I did it but my character stops after a while and that makes the movement even worse, how can I fix it?
@IIStaffyII4 жыл бұрын
@@dormix1376 Make sure u only normalize before applying the speed multiplier
@napoleon3842 жыл бұрын
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