[Unity C#] First Person Controller (E01: Basic FPS Controller and Jumping)

  Рет қаралды 177,479

Acacia Developer

Acacia Developer

Күн бұрын

Пікірлер: 529
@AcaciaDeveloper
@AcaciaDeveloper 4 жыл бұрын
Just to let everyone know, I'm currently revamping this series in 2020, and I already have the first episode out here: kzbin.info/www/bejne/hp6sgaR9ptVri7s. I strongly recommend following this instead since I've improved my methodology and included better visuals for beginners. Thanks!
@Jummmpy
@Jummmpy 4 жыл бұрын
you did not include jumping in the revamp. is that in ep. 2?
@maxmodjeski8128
@maxmodjeski8128 3 жыл бұрын
@@Jummmpy He hasn't made episode two yet, and its been months. I don't know if he's gonna even make it, so I just modified the movement script to have the jumping from this tutorial. Here's the code if you want it :) using System.Collections; using System.Collections.Generic; using UnityEngine; public class PlayerController : MonoBehaviour { [SerializeField] Transform playerCamera = null; [SerializeField] float mouseSensitivity = 3.5f; [SerializeField] float walkSpeed = 3f; [SerializeField] float gravity = -13f; [SerializeField] [Range(0f, 0.5f)] float mouseSmoothTime = 0.03f; float cameraPitch = 0f; float velocityY = 0f; CharacterController controller = null; [SerializeField] bool lockCursor = true; private bool isJumping; [SerializeField] private AnimationCurve jumpFallOff; [SerializeField] private float jumpMultiplier; [SerializeField] private KeyCode jumpKey; Vector2 currentMouseDelta = Vector2.zero; Vector2 currentMouseDeltaVelocity = Vector2.zero; // Start is called before the first frame update void Start() { controller = GetComponent(); if (lockCursor) { Cursor.lockState = CursorLockMode.Locked; Cursor.visible = false; } } // Update is called once per frame void Update() { UpdateMouseLook(); UpdateMovement(); } void UpdateMouseLook() { Vector2 targetMouseDelta = new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y")); currentMouseDelta = Vector2.SmoothDamp(currentMouseDelta, targetMouseDelta, ref currentMouseDeltaVelocity, mouseSmoothTime); cameraPitch -= currentMouseDelta.y * mouseSensitivity; cameraPitch = Mathf.Clamp(cameraPitch, -90f, 90f); playerCamera.localEulerAngles = Vector3.right * cameraPitch; transform.Rotate(Vector3.up * currentMouseDelta.x * mouseSensitivity); } void UpdateMovement() { Vector2 inputDir = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical")); inputDir.Normalize(); if (controller.isGrounded) { velocityY = 0f; } velocityY += gravity * Time.deltaTime; Vector3 velocity = (transform.forward * inputDir.y + transform.right * inputDir.x) * walkSpeed + Vector3.up * velocityY; controller.Move(velocity * Time.deltaTime); JumpInput(); } void JumpInput() { if(Input.GetKeyDown(jumpKey) && !isJumping) { isJumping = true; StartCoroutine(JumpEvent()); } } IEnumerator JumpEvent() { controller.slopeLimit = 90f; float timeInAir = 0f; do { float jumpForce = jumpFallOff.Evaluate(timeInAir); controller.Move(Vector3.up * jumpForce * jumpMultiplier * Time.deltaTime); timeInAir += Time.deltaTime; yield return null; } while (!controller.isGrounded && controller.collisionFlags != CollisionFlags.Above); controller.slopeLimit = 45f; isJumping = false; } }
@Jummmpy
@Jummmpy 3 жыл бұрын
@@maxmodjeski8128 thank you so much :D
@maxmodjeski8128
@maxmodjeski8128 3 жыл бұрын
@@Jummmpy No problem!
@ethanviolet1
@ethanviolet1 6 жыл бұрын
Finally a tutorial that doesn't teach you how to import standard assets! thanks
@joshuamason2227
@joshuamason2227 5 жыл бұрын
exactly
@not_herobrine3752
@not_herobrine3752 5 жыл бұрын
it's broken as hell in unity 2018 and up
@TracerBH
@TracerBH 5 жыл бұрын
@@not_herobrine3752 why
@BreadcrumbMC
@BreadcrumbMC 5 жыл бұрын
@@not_herobrine3752 it is working for me!
@Lightologyy
@Lightologyy 5 жыл бұрын
@@BreadcrumbMC Oh that's pretty cool! Congratulations and good luck in your project man :)
@AshTzu
@AshTzu 5 жыл бұрын
Great tutorial! Although may I add that in order to prevent the player from moving faster if moving on both the x and z axis you must first normalize the vector then multiply it by the movement speed variable: Vector3 forwardMovement = transform.forward * vertInput; Vector3 rightMovement = transform.right * horizInput; Vector3 moveDir = forwardMovement + rightMovement; moveDir.Normalize(); charController.SimpleMove(moveDir * movementSpeed);
@karpai5427
@karpai5427 5 жыл бұрын
It makes movement not responsive for me. Player moves for a moment without pressing buttons.
@SubparFiddle
@SubparFiddle 5 жыл бұрын
Just leaving this for any aspiring designers, but normalizing your movement vectors isn't always the right thing to do. For example the recent fps DUSK allows you to bunnyhop and move diagonally to build up massive speed and is a ton of fun once you've mastered it. Most new players will never realize this and play the game the normal "intended" way, but by not capping speed the skill ceiling of movement tech is increased exponentially for those who want to play with it.
@narkroshi88
@narkroshi88 6 жыл бұрын
You sound like a young Snape with a head cold. Good tutorial btw!
@AcaciaDeveloper
@AcaciaDeveloper 6 жыл бұрын
Oh gosh hahaha. You're the first person to make this joke in one of my newer videos. Glad this helped.
@thecomedyduo4001
@thecomedyduo4001 4 жыл бұрын
this is literally the first tutorial that actually worked for me. Brackey's tutorial didn't work and it was super confusing, you actually explained it in a great and simple way. at least for me. thank you so much!!!!
@Migaligaz
@Migaligaz 5 жыл бұрын
I think this is probably the best tutorial I have found so far. Subbed! Thanks!
@troy9217
@troy9217 5 жыл бұрын
As I learn to develop and make games, this channel has been a main support, thanks Matthew! Also, you posted this on my birthday!
@zombievirals
@zombievirals 6 жыл бұрын
Very useful! I was going to go with a pre-made FPS controller at first, but then I decided I would be better off doing something like this, and I'm really happy with the results! Thanks!!
@Avgunat0r
@Avgunat0r 6 жыл бұрын
This tutorial is outstanding in every way. Thank you & keep up the good work
@four-en-tee
@four-en-tee 4 жыл бұрын
This is an amazing tutorial, and you did a great job both walking me through this while explaining what everything you're doing will do to the player character. Thank you.
@racmanov
@racmanov 2 жыл бұрын
Many many thanks. I was doing Brackeys tutorial on this and i was hit with insane camera shutter. After many hours of solving and not accomplishing anything your tutorial worked wonders. No problem in editor or on build.
@b2eache2
@b2eache2 5 жыл бұрын
Love your code, love the fast pace, no going over 6000 things that people at this point should know i.e. installing unity.. mad respect! looking forward to continue learning from you! this is kinda code I want! none of that makeshift shiz!
@bertramkorsholm5059
@bertramkorsholm5059 5 жыл бұрын
I love that u sound like squidward. Thats the best part
@NGarreau12
@NGarreau12 4 жыл бұрын
I thought it was more like a younger Snape
@TrikaArts
@TrikaArts 5 жыл бұрын
thanks although im stil learning and i understood only 5% of what you re talking about but better than nothing
@katafalkistasaktyvuokwindo2739
@katafalkistasaktyvuokwindo2739 5 жыл бұрын
Of course. That's how you learn :P
@Eradifyerao
@Eradifyerao 4 жыл бұрын
@@katafalkistasaktyvuokwindo2739 Assuming you go and tinker yourself... Otherwise what you have is a whole pile of frustration.
@countertube3071
@countertube3071 4 жыл бұрын
@@katafalkistasaktyvuokwindo2739 nope he is just too fast. He write the complet script and close it if i have write 5 lines... Im try to make faster and make it faster... also the issues i make faster...and then i can look where this fcking failures are it... nice (learned my english with blueprints (2Jahrs) and Csgo... Cyka Blyad)
@Bcr3106
@Bcr3106 5 жыл бұрын
You know I actually prefer tutorials that go very fast like this. Pausing and repeating is much better than people that go way too slow. Thanks for this.
@petermoss7387
@petermoss7387 4 жыл бұрын
this series has a lot of helpful solutions to issues i was having with character controllers. thank
@Voidload
@Voidload 5 жыл бұрын
actually really really well done, do not fear to put your passion emotions into the video if you feel like it. thanks also for explaining most of the stuff
@TheGios100
@TheGios100 5 жыл бұрын
That's so good. I came to a point where the unity standard FPcontroller was not giving me the results i needed.
@vishistsd
@vishistsd 5 жыл бұрын
You're awesome. You helped me get started with my project which I couldn't do myself for weeks
@frederickmcguy1352
@frederickmcguy1352 5 жыл бұрын
Snape makes some good ass unity tutorials
@r.l.2708
@r.l.2708 5 жыл бұрын
Dude I was just thinking he sounds like Severus Snape
@evagagreel7974
@evagagreel7974 4 жыл бұрын
absolutely the best tutorial on the whole internet!!!!!!!!!!!!!!
@WeegeepieYT
@WeegeepieYT 6 жыл бұрын
Will you do a tutorial on Sprinting?! :)
@AcaciaDeveloper
@AcaciaDeveloper 6 жыл бұрын
Planned for a future episode, so yes!
@WeegeepieYT
@WeegeepieYT 6 жыл бұрын
Thanks uwu
@buddyroach
@buddyroach 6 жыл бұрын
public float walkSpeed = 10; public float runSpeed = 20; private float speed; void Start() { } void Update(){ if(Input.GetKey(KeyCode.LeftShift)) { speed = runSpeed; } else { speed = walkSpeed; } if (Input.GetKey (KeyCode.A)) { transform.Translate(Vector3.left * Time.deltaTime * speed, Space.Self); //LEFT } if (Input.GetKey (KeyCode.D)) { transform.Translate(Vector3.right * Time.deltaTime * speed, Space.Self); //RIGHT } if (Input.GetKey(KeyCode.W)) { transform.Translate(Vector3.forward * Time.deltaTime * speed, Space.Self); //FORWARD } if (Input.GetKey(KeyCode.S)) { transform.Translate(Vector3.back * Time.deltaTime * speed, Space.Self); //BACKWARD } } THIS CODE MAKES THE PLAYER AUTOMATICALLY ROTATE IN THE DIRECTION OF MOVEMENT. TO KEEP HIM FACING THE SAME WAY AT ALL TIMES, CHANGE THE " .Self " TO ".World"
@buddyroach
@buddyroach 6 жыл бұрын
same as my suggestion, except mine uses a public variable which can be changed in the inspector. i suppose you could make it a multiplier too instead of just a straight up value. and you could also put all the movement controls as public vars as well too. maybe later on when making a settings menu, with a controls sub menu, you can easily plug in the controller inputs from whatever the player chooses.
@buddyroach
@buddyroach 6 жыл бұрын
thanks
@playerqubo5158
@playerqubo5158 3 жыл бұрын
THIS IS......Awesome, thank you a lot!!! I wanna create my own fps game!!! You received a new sub!
@MoTheBlackCat
@MoTheBlackCat 5 жыл бұрын
Thank you very much for this great video, I like the detailed explanations and the result seems quite solid even in 2019. Still need to adapt and test a lot more but great start for me!
@TheOnlyArtifex
@TheOnlyArtifex 5 жыл бұрын
This is great! Lightweight character controller that's easy to understand and modify. I prefer this above the standard Unity character controller scripts that you can import. I especially think it's really elegant to use an animation curve as the jump force multiplier, I would've never come up with that. Thanks young Sna... Errr, Acacia!
@marino1805
@marino1805 5 жыл бұрын
Amazing video really helped me and the last fixes at the end were really nice.
@81Fredrick
@81Fredrick 6 жыл бұрын
dude you rock, for real and the explaining while writing the code helps a lot I add comments with // thanks again
@S4ND1X
@S4ND1X 5 жыл бұрын
This tutorial it's just awesome very well explained and very nice an clean code!
@imaginationgaming18
@imaginationgaming18 5 жыл бұрын
Finally Someone Pastes the code in the description
@andrupka8749
@andrupka8749 5 жыл бұрын
Yeah. I think same
@poobertop
@poobertop 4 жыл бұрын
A little more complex, but the jump method is the best I've seen on youtube.
@jcstudios2809
@jcstudios2809 5 жыл бұрын
thanks, helped a lot, I'm still learning this tutorial helped :)
@Maggiethegsd
@Maggiethegsd 4 жыл бұрын
You could use Mathf.Clamp function to clamp that float between 90 and -90 angle
@ungordoenapuros
@ungordoenapuros 5 жыл бұрын
Awesome, Acacia Developer! Easy, well explained and PRO "feeling" on using it! Thank you so much :)
@RebootedGaming
@RebootedGaming 6 жыл бұрын
Just a tip, use Input.GetAxisRaw for the mouse so it gets the raw mouse data. On top of that, don't multiply it by Time.deltaTime. For mouse input you shouldn't do that. Because in that case the mouse will only be smooth if you have a locked FPS, which you can of course set in the game engine though generally you don't want to lock the FPS in a game since other people might have a higher refresh rate.
@drowsy5384
@drowsy5384 6 жыл бұрын
Nice tips! Will apply in practice
@comradecheese3535
@comradecheese3535 5 жыл бұрын
what are you multiplying it by then? considering this method won't work without Time.deltaTime
@jayit6851
@jayit6851 5 жыл бұрын
If you don't multiply it by deltaTime the speed of the rotation will be frame rate dependent making faster computers have a faster rotation. That's the point of multiplying by deltaTime.
@storm5009
@storm5009 5 жыл бұрын
What should you input then?
@Cappuccino53
@Cappuccino53 5 жыл бұрын
Locking FPS is good, because: 1. Update() runs once each frame, so if you have more frames per second script will be run more times, so if it is an Enemy NPC that is shooting if player is close enough, then it will shoot out more bullets, because that line of code will be true more times in a second 2. If you are playing on a 60 or 30 fps and it doesn't change, then it is ok and you might not notice anything, but if FPS is changing non-stop between 30-60, then player will not only notice that, but also it will get annoying, because sometimes character reacts quickly on your controls, when sometimes it takes a little bit more which can make player die quickly. You can also search on google why some games lock their fps
@Fezezen
@Fezezen 5 жыл бұрын
If you start falling off the edge of something and press space, you can still jump. To fix this you should initially check if the character is grounded before allowing a jump.
@antiRuka
@antiRuka 5 жыл бұрын
This is actually a feature.
@u.s7072
@u.s7072 5 жыл бұрын
best Unity CC movement series to date
@JohnWeland
@JohnWeland 5 жыл бұрын
Awesome tutorial, It would be neat to enable the camera (player look) to be used via controller, player movement is already setup as such
@rodjownsu
@rodjownsu 4 жыл бұрын
Loved it, perfect pace for someone who has never used Unity, but is a C# developer, definitely not for new coders. Wonder why the Unity devs decided to go with regular method declaration rather than overriding the inhertied class method for 'start' 'update' etc.. Simpler for new users?
@babyfire6221
@babyfire6221 5 жыл бұрын
great video! this is a more advanced way to do the fpc and has teached me a lot thanks!
@Hiromu656
@Hiromu656 6 жыл бұрын
Great job with this, can't wait to see more from you.
@matexpl9245
@matexpl9245 5 жыл бұрын
Thank you very much for this tutorial. Your script is perfect for Networking with PUN 2. 6 lines and done! Players moves and rotates individualy correctly. With the Rigidbody FPS character controller from the unity standard assets... it's not that simple.
@danielfoutz
@danielfoutz 6 жыл бұрын
I appreciate how you explain things both clearly and quickly. So many KZbin tutorials take 2 minutes of introduction and then split each individual element into a separate video when the information could fit into a video around this size. Anyway, really excellent, I learned a lot.
@ДенисМаслов-т3х
@ДенисМаслов-т3х 6 жыл бұрын
Ты очень умный человек, спасибо тебе )))
@AcaciaDeveloper
@AcaciaDeveloper 6 жыл бұрын
Большое спасибо!
@ДенисАньенко
@ДенисАньенко 5 жыл бұрын
@Sound Engineer Звукоинженер Я сделал так же, все работает. Проверяй скрипт.
@wafflebell
@wafflebell 4 жыл бұрын
@@FoverosInsanity lol
@RegenerationOfficial
@RegenerationOfficial 5 жыл бұрын
One of if not the best yet.
@ДимаЛьвович-ь8д
@ДимаЛьвович-ь8д 5 жыл бұрын
3:45 You should NOT use Time.deltaTime here if you want it to be framerate independent, or it will do the opposite thing.
@RonanSmithUK
@RonanSmithUK 4 жыл бұрын
As the camera is always a child of the player body you don't have to assign it every time if you just get the reference using: playerBody = transform.parent.gameObject.transform;
@aeriozz7047
@aeriozz7047 6 жыл бұрын
please take it slow and take your time to explain how and why everything works instead of writing in super speed so i just get stressed out by it
@spazticjest
@spazticjest 6 жыл бұрын
You can adjust the speed of all youtube videos by clicking on the settings gear in the right corner. It has helped me a lot and I hope it helps you.
@tortomapachadas7980
@tortomapachadas7980 5 жыл бұрын
@@spazticjest just go to the seetings, set the video speed to 0.5 and enjoy a Unity lesson by Severus Snape at normal speed
@novaplum1617
@novaplum1617 5 жыл бұрын
Notice how the op said " how and why", the "why" being an important part of the comment. Simply slowing the video down will not explain the " why" for the those seeking more in depth explanations; it just provides for them, what they consider to be, complicated concepts at a slower speed.
@TRGTheReviewGuys
@TRGTheReviewGuys 5 жыл бұрын
Sadly there are no further uploads after the 4th the channel seems abandoned, I still Subscribed though in case he comes back honestly the best tutorial I have found (No offence Brackey).
@user-yh9sz6eo9y
@user-yh9sz6eo9y 5 жыл бұрын
Super useful and very well explained, thank you!
@jorgeMoreno-hk5gf
@jorgeMoreno-hk5gf 5 жыл бұрын
hi! can you say me how can i move the player when is in the air? regards
@Belarus360
@Belarus360 5 жыл бұрын
How to make sure that when you press the left-right arrow, the camera does not move left-right, but rotates right or left around its axis?
@pottedplantarmy
@pottedplantarmy 5 жыл бұрын
Your video thumbnail looks very professional.
@DapperNurd
@DapperNurd 5 жыл бұрын
This is such a good video dude. You explain what you are doing with little slides, it's so much better than a normal tutorial video on youtube. I feel like I'm learning stuff here rather than just doing what they do on screen. My only complaint is that you maybe go a little too fast when actually typing the code.
@maltesvensen1635
@maltesvensen1635 6 жыл бұрын
thank you you have the best tutorial for fps controllers, you helped me so much.
@SubliminalJohn
@SubliminalJohn 5 жыл бұрын
amazing the best teacher ever
@ArtisticallyGinger
@ArtisticallyGinger 5 жыл бұрын
Why did you stop making videos? You do a fantastic job at showing how to build stuff.
@residentsicko
@residentsicko 2 жыл бұрын
Once writing the code for the jump and setting the animation curve the editor gives an error when played maximized but no error when played focused. Also now the camera movement seems jittery. For me anyway.
@awpinator7634
@awpinator7634 5 жыл бұрын
You need to slow down very hard to follow along when you're moving so quick. It even sounds like you're typing like a mad lad.
@crump2072
@crump2072 5 жыл бұрын
Hes just experienced, its obviously you who can't keep up. I mean look at the comments around you most are positive. Maybe you're just slow?
@SetharofEdgarDead-Rose
@SetharofEdgarDead-Rose 5 жыл бұрын
Play Video, Watch Video, Pause Video, Write Code, Repeat!!!!!
@superjmm12345
@superjmm12345 3 жыл бұрын
he is going too slow for me, i need to see it at 2x speed XD
@JRHainsworth
@JRHainsworth 4 жыл бұрын
If I'm standing still under a low cieling and jump, the player sticks to the cieling for a moment before falling. This doesn't happen when I'm moving.
@zitrix7848
@zitrix7848 4 жыл бұрын
When i start the game in editor my player just flew up and i don’t knwo how to fix it but i can look in all the directions. please Help
@gamerbhaiyya_90ies
@gamerbhaiyya_90ies 5 жыл бұрын
thats what i was looking for ages ( i.e. since 2 days when i started to learn 3d gaming ;) thanks u so much ..!! one proper complete tuto
@inloaf6473
@inloaf6473 5 жыл бұрын
Hey i am running into error with unity where it doesnt let me use my script have you ran into this error to
@redline6802
@redline6802 6 жыл бұрын
Can you add make a tutorial on mid-air movement? I noticed that simple move returns if non-grounded and move in both coroutine and update doesn't work.
@zehsofficial
@zehsofficial 5 жыл бұрын
Yeah I have the same issue with moving while jumping
@TheCrazyLunatic8
@TheCrazyLunatic8 4 жыл бұрын
Whenever I press A or D, the engine seems to add both the vertical and the horizontal axes and the player just moves diagonally :/ I'm still learning and I just wanted to play around with the Unity engine, so, still don't know how to fix it.
@Ohmman
@Ohmman 4 жыл бұрын
would suggest rewatching the vid and paying close attention, and if that doesnt work go to the unity forums to see if theres something similar about it
@rredenvous
@rredenvous 5 жыл бұрын
This is the best tutorial ever , thank you very very much!!!
@problemchild959
@problemchild959 4 жыл бұрын
the only thing I don't like about this tutorial is you don't explain the conversion to the Euler Angles and hard lock it to a 90/-90. Honestly you should have used a variable and did a conversion so that people can change it. very few FPS games actually use 90 and -90 its more like -45 and about 70. very few people watching will have clue what to change the 270 and 90 to in order to adjust the clamping.
@Prolu7
@Prolu7 5 жыл бұрын
Thank you Acacia! You were a big help!
@thegamer9b603
@thegamer9b603 5 жыл бұрын
Amazing tutorial, really helped me, thank you
@aresstavropoulos916
@aresstavropoulos916 5 жыл бұрын
great video, but I have one problem. Whenever I create a variable, specifically [SerializeField] private Transform playerBody; on time 9:45, it doesn't show up in the inspector under PlayerCamera. Any ideas?
@MoreNimrod
@MoreNimrod 4 жыл бұрын
Not sure why, but I was getting weird stuttering while playing around with this using Vulkan. Under DX11 it seems fine. I assume it's an API or Unity bug, or because the FPS is too high or some odd reason.
@aayushtyagi8419
@aayushtyagi8419 3 жыл бұрын
Man, You are So Cool this is really helpful thanks:)
@therealmemernet
@therealmemernet 6 жыл бұрын
I literally had to slow the video down to 0.25 because he is too fast for me
@mamad7976
@mamad7976 6 жыл бұрын
0.75 sounds more natural
@therealmemernet
@therealmemernet 6 жыл бұрын
True
@user-ms9yk5ug3e
@user-ms9yk5ug3e 5 жыл бұрын
what do i do if i whant to control movement in air
@john_slickk2204
@john_slickk2204 5 жыл бұрын
'isJumping' is not working in my Unity Version 2019.2.6f1 , what to do, and how can I implement it?
@johanhaggmark3499
@johanhaggmark3499 5 жыл бұрын
Jumping wasn't working for me either. I couldn't find a place where "JumpInput();" were called. By putting the method call in PlayerMovement(), the character started jumping
@john_slickk2204
@john_slickk2204 5 жыл бұрын
@@johanhaggmark3499 thanks man
@quopot4073
@quopot4073 5 жыл бұрын
10:10 you said that -Transform.right has to be changed to Vector3.left preventing camera prom weird rotation, but even though I changed it camera is rotating as is shouldn't happend. I went to your git hub page and copied your script but same this happend....
@JustGaming46
@JustGaming46 5 жыл бұрын
Did you happen to find a fix, having the same problem...
@vaqquixx8620
@vaqquixx8620 6 жыл бұрын
I loved your other fps controller video but I couldn't figure out how to make it jump so thanks for this version
@endermanhunter4ugaming569
@endermanhunter4ugaming569 5 жыл бұрын
it worked good untill i added the jump part whenever i start the scene my character gets sent to the fucking shadow realm
@Xinamottoo
@Xinamottoo 4 жыл бұрын
i did the same thing att the beginning but i can't look on Y axis at 5:05 where you could
@riccardobancone3761
@riccardobancone3761 6 жыл бұрын
Excellend explanations, please keep doing tutorials!
@MrDaviiss
@MrDaviiss 6 жыл бұрын
13:23 whats the difference between using GetComponent and [SerializeField] when we can attach the component through inspector? i've always been taught to avoid using GetComponent or using it in the extreme situations, because a lot of GetComponents could have terribly impact on our game
@zehsofficial
@zehsofficial 5 жыл бұрын
get component is useful when you want to access a script from a object prefab and edit that exact script for that object that can be cloned
@Spartan1331
@Spartan1331 4 жыл бұрын
Thank you, I learn a lot from this Video.
@Nangleator22
@Nangleator22 5 жыл бұрын
I missed the boat. The recent version of Unity doesn't have any character controller presets, nor scripts. It's impossible to follow this tutorial without those. My Empty asset isn't even a capsule, but an envelope in the scene list and invisible on the stage. The asset store seems to have only one free character controller package, but that's insanely complex, as if for a full game, and it's third person, when I want first person. I guess I'll try Unreal again.
@connorforman9143
@connorforman9143 5 жыл бұрын
the playerMove script makes the looking mechaninc all twitchy for some reason. It moves like dit-dit-dit-dit like it's low FPS. The movement isn't twitchy, just the looking.
@telecomanda
@telecomanda 5 жыл бұрын
When I save the script and go back to Unity, on the Camera game object, in the script component the Sensitivity, MouseX and MouseY doesn't show up! Please help me fix it!
@arvinkhoshboresh
@arvinkhoshboresh 5 жыл бұрын
run the game once and then stop, it should come up.
@DJLKM1
@DJLKM1 5 жыл бұрын
Thanks for the tutorial, controller works great, only gripe is about your work flow speed, im getting fairly good at coding in C# but found it hard keeping up with what you were doing and why.
@Guyfrom2001
@Guyfrom2001 5 жыл бұрын
Thanks for the video, nice work👌
@lukeavery7174
@lukeavery7174 5 жыл бұрын
i need some help when ever i input the following code it has red lines from Input to movementSpeed can someone see a problem? float horizInput = Input.GetAxis(horizontalInputName) * movementSpeed * Time.deltaTime; float vertInput = Input.GetAxis(verticalInputName) * movementSpeed * Time.deltaTime;
@rans0m_cs
@rans0m_cs 3 жыл бұрын
I know this is an older series, but I implemented this jump script with the newer movement script that you've posted and it works, but I find that my jump key doesn't register ever single time, but rather every 2 or 3 presses unless I get lucky and I can jump muliple times in a row without fail. Any idea what could be causing this bug?
@andersonmyguy5054
@andersonmyguy5054 5 жыл бұрын
Thanks! Great video! I have one issue though, when my character jumps and hits a ceiling, he keeps floating instead of dropping straight down, he only goes down after the jump doesn't have anymore force, i dont know whats wrong. Please help
@jakobsharp8456
@jakobsharp8456 5 жыл бұрын
I just had the same issue. In the PlayerMove script between the lines "timeInAir~" and "yield return null" add: if ((charController.collisionFlags & CollisionFlags.Above) != 0) { break; } The while loop should be catching the collisions from above, but doesn't for some reason. My implementation probably isn't the best, but it seems to work.
@JoshGamingZone
@JoshGamingZone 5 жыл бұрын
this help alot thanks for making this video:>
@markuswikstrom3690
@markuswikstrom3690 5 жыл бұрын
Thanks for the video, it helped me a lot ^^
@w0tnessZA
@w0tnessZA 2 жыл бұрын
Awesome tutorial! Thank you!
@mikebely8663
@mikebely8663 5 жыл бұрын
what I have noticed, if I rotate 360 in one direction several times it finally blocks me from rotating that direction. Not sure what I could have missed, followed script exactly. Anyone else have this problem? Doesn't happen consistently though.
@Serz__
@Serz__ 5 жыл бұрын
UPDATE: I misunderstood how euler rotation worked, I changed the value passed in to ClampXAxisRotationToValue to equal 45.0, and now it clamps properly when I look down. So now i'm just passing in "-clampDown" to ClampXAxisRotationToValue, this is also working with looking up as you might expect. If I set the clamp for the camera looking down to anything other than directly down (-90) the camera freaks out. For example: I have it set to say this: clampDown is set to -45.0f here else if (xAxisClamp < clampDown) //Player looking down { xAxisClamp = clampDown; mouseY = 0.0f; ClampXAxisRotationToValue (clampDown + 180.0f); //Looking directly down is actually 90.0 in euler rotation } The value passed in to ClampXAxisRotationToValue will then be 135.0f I don't really see why that would bug it out, it works if I change the value of clampDown to -90.0f but anything else just breaks
@theholysalt18
@theholysalt18 5 жыл бұрын
Serz can I ask a question, about something
@vibe5556
@vibe5556 5 жыл бұрын
console error '* cannot be applied to operands of type float and string. What to do tell me pls....
@sure5679
@sure5679 5 жыл бұрын
using string movementSpeed, instead of float?
@sure5679
@sure5679 5 жыл бұрын
i changed to float, i had mistakenly written string instead of float
@vibe5556
@vibe5556 5 жыл бұрын
Ok, I got it.
@aw1lt
@aw1lt 4 жыл бұрын
it says that ‘Cursor’ does not contain a definition for ‘LockState’
@vinni_animates7381
@vinni_animates7381 2 жыл бұрын
well it still works in 2022
@varunshivaram711
@varunshivaram711 5 жыл бұрын
Superb tutorial very on point and helpful..... can you link the environment assets in the description so we can use while prototyping looks good
@죠타롱
@죠타롱 5 жыл бұрын
This tutorial really easy & usefull and powerfull to make 3D Games ever! thanks to awswome video!
@sure5679
@sure5679 5 жыл бұрын
Operator '*' cannot be applied to operands of type 'float' and 'string', on float horInput = Input.GetAxis(horizontalInputName) * movementSpeed;, it does not understand that Input.GetAxis does not return a string value :(
@sure5679
@sure5679 5 жыл бұрын
nevermind, i was using string movementSpeed, instead of float
@oharacare
@oharacare 4 жыл бұрын
i have argument exception errors for both scripts saying no input axis
[Unity] First Person Controller [E01: Basic Controller]
20:51
Acacia Developer
Рет қаралды 161 М.
[Unity C#] First Person Controller (E02: Fixing Diagonal Movement Speed)
2:57
Can You Beat Minecraft From One Grass Block?
35:27
Beppo
Рет қаралды 6 МЛН
THIRD PERSON MOVEMENT in Unity
21:05
Brackeys
Рет қаралды 1,5 МЛН
How to jump in Unity (with or without physics)
16:09
Game Dev Beginner
Рет қаралды 50 М.
PERFECT Weapon Aiming! (IK, Unity Tutorial Third Person Shooter)
13:36
How to make The Best First Person Camera in Unity
9:04
semikoder
Рет қаралды 27 М.
The Creation of A Short Hike
8:32
IndieInfinity
Рет қаралды 10 М.
How to get Good Graphics in Unity
8:14
Brackeys
Рет қаралды 1,2 МЛН
FIRST PERSON MOVEMENT in 10 MINUTES - Unity Tutorial
9:58
Dave / GameDevelopment
Рет қаралды 1,1 МЛН
Make an Awesome Launcher for all your Games!
13:34
Code Monkey
Рет қаралды 58 М.