Тёмный

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

Acacia Developer
Подписаться 8 тыс.
Просмотров 177 тыс.
50% 1

Опубликовано:

 

16 окт 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 530   
@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: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-PmIPqGqp8UY.html. I strongly recommend following this instead since I've improved my methodology and included better visuals for beginners. Thanks!
@Jummmpy
@Jummmpy 3 года назад
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 5 лет назад
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 :)
@davidruttan713
@davidruttan713 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 4 года назад
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.
@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!
@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!
@AnecProductions
@AnecProductions 5 лет назад
thanks although im stil learning and i understood only 5% of what you re talking about but better than nothing
@katafalkistasaktyvuokwindo2739
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)
@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!!
@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.
@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.
@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.
@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 4 года назад
I love that u sound like squidward. Thats the best part
@NGarreau12
@NGarreau12 4 года назад
I thought it was more like a younger Snape
@frederickmcguy1352
@frederickmcguy1352 4 года назад
Snape makes some good ass unity tutorials
@r.l.2708
@r.l.2708 4 года назад
Dude I was just thinking he sounds like Severus Snape
@Avgunat0r
@Avgunat0r 6 лет назад
This tutorial is outstanding in every way. Thank you & keep up the good work
@Bcr3106
@Bcr3106 4 года назад
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 3 года назад
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
@ДенисМаслов-т3х
@ДенисМаслов-т3х 6 лет назад
Ты очень умный человек, спасибо тебе )))
@AcaciaDeveloper
@AcaciaDeveloper 6 лет назад
Большое спасибо!
@ДенисАньенко
@ДенисАньенко 5 лет назад
@Sound Engineer Звукоинженер Я сделал так же, все работает. Проверяй скрипт.
@WaffleTM420
@WaffleTM420 3 года назад
@@FoverosInsanity lol
@vishistsd
@vishistsd 5 лет назад
You're awesome. You helped me get started with my project which I couldn't do myself for weeks
@evagagreel7974
@evagagreel7974 4 года назад
absolutely the best tutorial on the whole internet!!!!!!!!!!!!!!
@imaginationgaming18
@imaginationgaming18 4 года назад
Finally Someone Pastes the code in the description
@andrupka8749
@andrupka8749 4 года назад
Yeah. I think same
@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!
@playerqubo5158
@playerqubo5158 3 года назад
THIS IS......Awesome, thank you a lot!!! I wanna create my own fps game!!! You received a new sub!
@poobertop
@poobertop 4 года назад
A little more complex, but the jump method is the best I've seen on youtube.
@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
@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?
@marino1805
@marino1805 5 лет назад
Amazing video really helped me and the last fixes at the end were really nice.
@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!
@TRGTheReviewGuys
@TRGTheReviewGuys 4 года назад
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).
@81Fredrick
@81Fredrick 5 лет назад
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!
@u.s7072
@u.s7072 5 лет назад
best Unity CC movement series to date
@jcstudios2809
@jcstudios2809 5 лет назад
thanks, helped a lot, I'm still learning this tutorial helped :)
@babyfire6221
@babyfire6221 5 лет назад
great video! this is a more advanced way to do the fpc and has teached me a lot thanks!
@user-yh9sz6eo9y
@user-yh9sz6eo9y 4 года назад
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
@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
@RegenerationOfficial
@RegenerationOfficial 5 лет назад
One of if not the best yet.
@ungordoenapuros
@ungordoenapuros 5 лет назад
Awesome, Acacia Developer! Easy, well explained and PRO "feeling" on using it! Thank you so much :)
@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.
@Hiromu656
@Hiromu656 6 лет назад
Great job with this, can't wait to see more from you.
@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
@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
@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
@pottedplantarmy
@pottedplantarmy 5 лет назад
Your video thumbnail looks very professional.
@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
@Spartan1331
@Spartan1331 4 года назад
Thank you, I learn a lot from this Video.
@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
@zombietutorials8511
@zombietutorials8511 6 лет назад
Great episode I absolutely love that I found this channel, hope to see way more tutorials in the near future! Also a little question I have, I might find a solution but whatever, how do you call the co-routine while still being able to move around? Thanks in advance :D
@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
@aayushtyagi8419
@aayushtyagi8419 3 года назад
Man, You are So Cool this is really helpful thanks:)
@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?
@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.
@rans0m_cs
@rans0m_cs 2 года назад
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?
@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.
@w0tnessZA
@w0tnessZA 2 года назад
Awesome tutorial! Thank you!
@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.
@YTBilges
@YTBilges 4 года назад
This is the most helpful FPS controller tutorial for Unity I've come across so far. I realize this video is almost two years old, but I've heard you don't want to use Time.deltaTime when dealing with mouse movement because the mouse is an asynchronous input device (i.e., its position changes over time, not per frame). Is that right?
@rredenvous
@rredenvous 4 года назад
This is the best tutorial ever , thank you very very much!!!
@derrickstanton9
@derrickstanton9 5 лет назад
Hey, great video. :) Question, though. Why separate the movement and look scripts? Why not have the functionality of both on the same script? Is there a downside to putting them both in one? Thanks!
@maltesvensen1635
@maltesvensen1635 6 лет назад
thank you you have the best tutorial for fps controllers, you helped me so much.
@ank0kulion_780
@ank0kulion_780 4 года назад
My character doesn't work when I press "w" or "s". It can be said that it is not possible to move, help me please.
@vitoderpro6969
@vitoderpro6969 4 года назад
me too
@antonworch4128
@antonworch4128 4 года назад
​@@vitoderpro6969 That´s My Player_Move Script: using System.Collections; using System.Collections.Generic; using UnityEngine; public class Player_Move : MonoBehaviour { [SerializeField] private string horizontalInputName; [SerializeField] private string verticalInputName; [SerializeField] private float movementSpeed; private CharacterController charController; [SerializeField] private AnimationCurve jumpFallOff; [SerializeField] private float jumpMultiplier; [SerializeField] private KeyCode jumpKey; private bool isJumping; private void Awake() { charController = GetComponent(); } private void Update() { PlayerMovement(); } private void PlayerMovement() { float horizInput = Input.GetAxis(horizontalInputName) * movementSpeed; float vertInput = Input.GetAxis(verticalInputName) * movementSpeed; Vector3 forwardMovement = transform.forward * vertInput; Vector3 rightMovement = transform.right * horizInput; charController.SimpleMove(forwardMovement + rightMovement); JumpInput(); } private void JumpInput() { if(Input.GetKeyDown(jumpKey) && !isJumping) { isJumping = true; StartCoroutine(JumpEvent()); } } private IEnumerator JumpEvent() { charController.slopeLimit = 90f; float timeInAir = 0f; do { float jumpForce = jumpFallOff.Evaluate(timeInAir); charController.Move(Vector3.up * jumpForce *jumpMultiplier *Time.deltaTime); timeInAir += Time.deltaTime; yield return null; } while (!charController.isGrounded && charController.collisionFlags != CollisionFlags.Above); charController.slopeLimit = 45f; isJumping = false; } }
@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
@Prolu7
@Prolu7 5 лет назад
Thank you Acacia! You were a big help!
@S4ND1X
@S4ND1X 5 лет назад
Hi! Just one question, what does exactly -tranform.right * mouseY does?
@danielfoutz
@danielfoutz 6 лет назад
I appreciate how you explain things both clearly and quickly. So many RU-vid 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.
@Vrethagon
@Vrethagon 5 лет назад
This has been an awesome series and I have followed through till the end except I can't figure out one thing! If you wanted to move left and right/turn around mid air, how could you go about this?
@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
@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.
@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.
@Guyfrom2001
@Guyfrom2001 5 лет назад
Thanks for the video, nice work👌
@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?
@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.
@buddyroach
@buddyroach 6 лет назад
how would i add " , Space.Self" to this script?? My player rotates in different orientations for special powerups, but i want the direction to remain the same no matter how he is rotated.
@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
@cheeriosaregood920
@cheeriosaregood920 4 года назад
For some reason after typing the first of the mouse look script, I don’t have the extra options in the player look script in player camera. Am I doing something incorrect?
@SubliminalJohn
@SubliminalJohn 5 лет назад
amazing the best teacher ever
@robylplays
@robylplays 4 года назад
how can i unlock the cursor ? so i can make a pause menu pls help
@unaxvicuna4267
@unaxvicuna4267 4 года назад
I don't understand very good your question but if you want to know how you can see again your mouse you can put this: Cursor.lockState = CursorLockMode.None
@NedinCEO
@NedinCEO 4 года назад
press esc and move ur curser to stop
@tsgnow
@tsgnow 5 лет назад
This is very useful. Thank you very much.
@realstudios3634
@realstudios3634 5 лет назад
Pops up and such an error in the code Assets / PoruszanieKamera / PlayerLook.cs (4,7): error CS0246: The type or namespace name `UnityCursor 'could not be found. Are you missing an assembly reference? how can I fix it and I'm new so I don't know you so well ;)
@liambinford1038
@liambinford1038 4 года назад
Fantastic tutorial, but I am having one issue: The movement of the player works fine, but when I'm using the camera, it seemingly randomly jitters, skipping some movement, moving much faster for like a millisecond. I'm not sure what's causing this, so some advice would be amazing.
@jackalacken
@jackalacken 4 года назад
Make sure you didn’t put the camera movement into fixedupdate, always make sure input is done in update. I think that’s what you need to do anyway I’m still new too so yeah.
@vinniciusrosa8284
@vinniciusrosa8284 4 года назад
THANK YOU! Fantastic!
@stachopl2737
@stachopl2737 5 лет назад
finally I found my mistikate in code "why my character doesn't go to forward " Thanks :D
@NedinCEO
@NedinCEO 4 года назад
Hey if i look up the cam looks down and if i look down the cam looks up how can i fix this
@thegamer9b603
@thegamer9b603 5 лет назад
Amazing tutorial, really helped me, thank you
@mfatihbilhaq4977
@mfatihbilhaq4977 6 лет назад
Thanks man
@theyourayclips7609
@theyourayclips7609 4 года назад
i got "Operator '*' cannot be applied to operands of type float and String" What is that mean? Thx before ^_^
@nanday_
@nanday_ 4 года назад
Simply put, you can't multiply a float (a decimal number) with a string (a portion of text). Check your code!
@thegraveyardshift7625
@thegraveyardshift7625 5 лет назад
I just love the fact he sounds like professor Snape lol
@SetharofEdgarDead-Rose
@SetharofEdgarDead-Rose 5 лет назад
LMFAO!!!!!
@Glentgm
@Glentgm 5 лет назад
Why use private serrialized over public?
@finnbuhse4775
@finnbuhse4775 5 лет назад
because public means other classes can see and modify it, with a benefit of being able to see and modify it in the inspector. However serialize field means you can see and modify in the inspector exclusively and other classes cant see or modify it. I am unsure but this possibly improves performance and increases security of the variables and lowers the chance of them being tampered with. Hope that helped :D
@Glentgm
@Glentgm 5 лет назад
@@finnbuhse4775 i see,thanks for the awnser
@jayit6851
@jayit6851 5 лет назад
@@Glentgm And that's just best practice. You shouldn't allow access to anything that doesn't need it. So make it private serialized unless you have to make it public.
@Guyfrom2001
@Guyfrom2001 5 лет назад
Camera movement is mega slow for some reason I dunno if it’s a PC problem, or something Any input?
@vaxvital4641
@vaxvital4641 6 лет назад
my look isnt working! HELP! it plays but doesnt lock the mouse in the middle. whats wrong?
@maltesvensen1635
@maltesvensen1635 6 лет назад
are you sure that you typed "Cursor.lockState = CursorLockMode.Locked;" in the Start method?
@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 5 лет назад
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 4 года назад
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.
@Maggiethegsd
@Maggiethegsd 4 года назад
You could use Mathf.Clamp function to clamp that float between 90 and -90 angle
@user-ms9yk5ug3e
@user-ms9yk5ug3e 5 лет назад
what do i do if i whant to control movement in air
@thedarkside0007
@thedarkside0007 5 лет назад
what is the point of ClampXAxisRotationToValue() ? i dont feel it's needed the if condition isnt enough ?
@jayit6851
@jayit6851 5 лет назад
Update isn't exact, it's locked to frame rate. So if you rotate the Camera fast enough, the Camera will overshoot the bound but your clamp value will be clamped. So it will slightly offset your rotation range everytime. Do it enough times and you can flick the camera around.
@donaldclark2735
@donaldclark2735 4 года назад
This is great thanks, I've discovered one weird bug, if I move sideways I can jump, but if I run forward or back I can't. I think this might have something to do with the slopeForce? Any ideas?
@Lloydibus
@Lloydibus 2 года назад
Somehow my Player is moving inverted. Like I press D he goes left instead of right. Any tipps? :(
@죠타롱
@죠타롱 5 лет назад
This tutorial really easy & usefull and powerfull to make 3D Games ever! thanks to awswome video!
Далее
No One Hires Jr Devs So I Made A Game
39:31
Просмотров 169 тыс.
怎么能插队呢!#火影忍者 #佐助 #家庭
00:12
TAS Explained: Super Mario Bros. 3 in 0.2 seconds
19:39
[Unity] First Person Controller [E01: Basic Controller]
20:51
Dear Game Developers, Stop Messing This Up!
22:19
Просмотров 720 тыс.
How These Videos Ruined My Game
16:40
Просмотров 40 тыс.
THIRD PERSON MOVEMENT in Unity
21:05
Просмотров 1,4 млн
The Creation of A Short Hike
8:32
Просмотров 8 тыс.