Тёмный

Creating an FPS Controller in Unity (Movement, Footsteps, Jumping) 

SpeedTutor
Подписаться 123 тыс.
Просмотров 11 тыс.
50% 1

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

 

14 окт 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 68   
@SpeedTutor
@SpeedTutor Год назад
➡This Controller with the New Input System: ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-b0AQ6IENZFg.html 🔥Unity Sales: bit.ly/UnitySalesHub 🔥SpeedTutor Unity Store: bit.ly/STUnityStorePuzzlePacks 🔥HUMBLE SAVINGS: bit.ly/HumbleBundleDeals
@Gurem
@Gurem Год назад
Simply sublime base controller. Best one I've ever gotten from youtube.
@SpeedTutor
@SpeedTutor Год назад
I'm really happy that you found it useful! :) Good luck with your project too! :)
@mirfasiuddin2161
@mirfasiuddin2161 Год назад
This tutorial is a lifesaver for aspiring game developers like me! 🙌🕹 Creating a first-person shooter (FPS) controller from scratch can be daunting, but your step-by-step guide makes it seem much more manageable. You've explained everything, from movement to footstep sounds and jumping mechanics, which is amazingly understandable and easy to follow. I especially appreciate the attention to detail and the practical tips you've shared throughout the video. You're not just showing us how to make a first-person shooter (FPS) controller but also teaching us best practices and optimization techniques. I can't wait to implement this in my own Unity project. Thank you so much for sharing your knowledge and making game development more accessible! 🚀🎮
@SpeedTutor
@SpeedTutor Год назад
Thanks for coming to watch and give me your opinion, my friend! :) I try my best to lay it all out to make it easy to refer to and go back and learn things. Especially if you don't need the extra features. Are you working on anything at the moment?
@mirfasiuddin2161
@mirfasiuddin2161 Год назад
@@SpeedTutor You're very welcome! Your dedication to creating informative and accessible content is evident, and it's much appreciated. As for my current projects, I'm continually improving my skills and knowledge, aiming to assist and provide valuable information wherever possible. If there's anything specific you'd like to know or discuss, Please feel free to ask-I'm here to help! 😊📚 #ContentCreation #KnowledgeSharing #AlwaysLearning
@davidmiles2055
@davidmiles2055 Год назад
Love your tuts! Your voice and accent are great ;)
@SpeedTutor
@SpeedTutor Год назад
Thanks David, I really appreciate it my friend! :)
@SamNBCA
@SamNBCA Год назад
Great video, One thing to address would be diagonal movement having a different velocity. Pressing 2 movements keys at once, [W] & [D] for example results in our character moving slightly faster than just pressing forward. There should be a step in there to normalize the input values before we apply the speed multiplier.
@SpeedTutor
@SpeedTutor Год назад
Oh that's a very fair point, thanks for pointing that out! I hope others will see this and take it into account. I appreciate you taking the time to watch and respond! :D
@SamNBCA
@SamNBCA Год назад
If anyone is curious here's how I corrected the diagonal movement going faster than intended. void HandleMovement() { float speedMultiplier = Input.GetKey(sprintKey) ? sprintMultiplier : 1f; // Use Input.GetAxisRaw or the character will keep moving a few frames after button release. Vector3 horizontalMovement = new Vector3(Input.GetAxisRaw(horizontalMoveInput), 0, Input.GetAxisRaw(verticalMoveInput)).normalized; horizontalMovement = transform.rotation * horizontalMovement; HandleGravityAndJumping(); currentMovement.x = horizontalMovement.x * walkspeed * speedMultiplier; currentMovement.z = horizontalMovement.z * walkspeed * speedMultiplier; characterController.Move(currentMovement * Time.deltaTime); } The important part is normalizing the input values before applying the speed multiplies. also you need to use "Input.GetAxisRaw" or the character will keep moving a few frames after button release. hope this helps. Cheers
@Gurem
@Gurem Год назад
@@SamNBCA Using raw makes movement more responsive but choppy. The trade off may not be worth it but this is highly dependent on your use case. Please bear this in mind for anyone who is going to use this fix. Just remove the Raw keyword if you want the fluidity back.
@carlabalos3884
@carlabalos3884 11 месяцев назад
@@Gurem I think just removing the Raw key word will not bring back the fluidity of the input. I tested it and the character still moves a bit longer than usual. His workaround fixed the normalizing issue which is important but the movement halt asap as the key is release. I found another workaround by just adjusting some settings on the input settings and the feel of using Input.GetAxis feels the same just my experience. The sweet spot for my gravity is 7 and 3 for sensitivity both horizontal/vertical. Here is the forum where I base my workaround. discussions.unity.com/t/character-keeps-moving-a-moment-after-i-release-input-keys/132547/2
@pyt3z
@pyt3z Год назад
Wonderful tutorial Matt, I have been looking for something like this ever since I started with Unity game development when I was 11(Currently 14).
@SpeedTutor
@SpeedTutor Год назад
It's amazing that you're here and learning! Thanks for coming to watch, my friend! :)
@pyt3z
@pyt3z Год назад
​@@SpeedTutor Your welcome Matt. Keep up the good work and time you put in these tutorials. :)
@asafbenjaminov2635
@asafbenjaminov2635 3 месяца назад
Thanks for this tutorial! it helped me alot! I actually found a bug in the beggining of the video where you multiply each axis by the speed and multiplier but this creates a situation where when walking diagonally the speed is increased The solution i found was to create a direction vector from the inputs and then multiply the normalized vector by the speed float
@SpeedTutor
@SpeedTutor 3 месяца назад
Yes, you're exactly right! I did create a new version like this for the newer input system and I did fix that issue as I recall. Thanks for the thoughts though! :)
@FallenAngel-yd7fp
@FallenAngel-yd7fp 4 месяца назад
Amazing guide. You are my Hero!
@SpeedTutor
@SpeedTutor 4 месяца назад
You're very welcome, my friend! :D What are you creating?
@FallenAngel-yd7fp
@FallenAngel-yd7fp 4 месяца назад
@@SpeedTutor i'm working on my project for college. we were poorly explained about the new input system, and there were no records or alternative sources.
@SpeedTutor
@SpeedTutor 4 месяца назад
I'm glad I could help you out! Best of luck with your college project.
@akash_the_phenomenal
@akash_the_phenomenal Год назад
Keep up in this 🔥 I will follow along
@SpeedTutor
@SpeedTutor Год назад
Thanks, I hope you find it useful! :)
@veal225
@veal225 6 месяцев назад
Great tutorial!
@SpeedTutor
@SpeedTutor 6 месяцев назад
Thanks for checking this out! :)
@lowHP_
@lowHP_ Год назад
thanks for your valuable videos
@SpeedTutor
@SpeedTutor Год назад
You're very welcome, thanks for coming along to watch it! :D
@Gorila-el8yw
@Gorila-el8yw 3 месяца назад
thank you you are the best
@SpeedTutor
@SpeedTutor 3 месяца назад
You're very welcome! :)
@MrInvit
@MrInvit Год назад
Need tutorial on how to fix Character Controller bugs: with slopes (bouncing and changing speed). Not only with perfect collider rectangles, but on surfaces with roughness (MeshCollider or multiple colliders), since on them the collider normal moves the character along itself, changing its movement. Stuck on edges and inclined surfaces when the collider tilt angle limit is exceeded. A character controller can loop with the collider on any inclined surface (even 89 degrees) and get stuck or jump from it. There are many tutors, where these problems are solved separately, but there is no one where they are all solved together. The solution of one problem affects another and breaks it.
@SpeedTutor
@SpeedTutor Год назад
Thanks very much for the suggestions, I'll see what I can do! :)
@PostiveBalances
@PostiveBalances 9 месяцев назад
Hi, loving the tutorial, but im getting an error at 9.35 saying NullReferenceException: Object reference not set to an instance of an object fpsController.HandleRotation () (at Assets/Scripts/playerController.cs:60) fpsController.Update () (at Assets/Scripts/playerController.cs:36)
@SpeedTutor
@SpeedTutor 9 месяцев назад
Are you missing any references in the inspector?
@PostiveBalances
@PostiveBalances 9 месяцев назад
@@SpeedTutor yep changed camera tag to "maincamera"
@angelawalsh7851
@angelawalsh7851 11 месяцев назад
Thanks!
@SpeedTutor
@SpeedTutor 11 месяцев назад
You're very welcome and I appreciate the kind thanks! :) How did you find me?
@JBtheWARVillain
@JBtheWARVillain Год назад
If you haven't done already, could you make a 3rd person controller also? Clean and clear tutorial again, thanks
@SpeedTutor
@SpeedTutor Год назад
I actually have a couple of tutorials in my description about that actually! :)
@genasols.r.l4910
@genasols.r.l4910 Год назад
Good video, can it be used to handle slopes?
@SpeedTutor
@SpeedTutor Год назад
I think the CharacterController does take slopes into account by default without any extra ground work. As per the slope amount in the CharacterController. :) I'm not 100% though.
@Sewaskal
@Sewaskal Год назад
underrated
@SpeedTutor
@SpeedTutor Год назад
Did you find it useful?
@adamabbott2014
@adamabbott2014 6 месяцев назад
sorry, I can not understand about speed = transform.rotation* speed in 5:52. i comment this line. it looks object's moving well.
@SpeedTutor
@SpeedTutor 6 месяцев назад
Awesome, I'm glad its up and running :)
@masonmmmmunch847
@masonmmmmunch847 Год назад
Great tutorial! I dont know if I mis-typed some code, but my character when standing still is unable to jump, do you know how I'd fix that?
@SpeedTutor
@SpeedTutor Год назад
I'm not sure without seeing some of the code, did you put the jumping method in the correct place?
@masonmmmmunch847
@masonmmmmunch847 Год назад
it was to do with currentMovement.y in the handle gravity block. I dont know why but replacing the -0.5f with -1f instead seemed to do the job.@@SpeedTutor
@akash_the_phenomenal
@akash_the_phenomenal Год назад
🔥🔥🔥
@SpeedTutor
@SpeedTutor Год назад
Thanks man! :)
@SGUDevs
@SGUDevs 4 месяца назад
what happen if its the same like person and a vehicle? or will i have to rewrite script but reducing certain things?
@SpeedTutor
@SpeedTutor 4 месяца назад
I'm not sure what you're asking?
@SGUDevs
@SGUDevs 4 месяца назад
@@SpeedTutorhaving different character types for this script to work with
@ryanh.1346
@ryanh.1346 9 месяцев назад
Would anyone have a solution to the little "sliding" I want it to stop immediately when I let go and not move for a short time after I release the button?
@FONORX
@FONORX 8 месяцев назад
Landing sound after jumping... neeed
@STYM-wx9mt
@STYM-wx9mt Год назад
Can you make a tutorial for movement by touch input and virtual joystick 🕹
@Artifical_Deforum
@Artifical_Deforum Год назад
Diztel magic has a fantastic tutorial already that uses unitys input system and their fps controller Once you understand how to use it and how it works you can apply it to anyone's controller for mobile.
@SpeedTutor
@SpeedTutor Год назад
That's pretty cool, I always recommend Rewired because it does it all without issue :)
@Huzzy267
@Huzzy267 Месяц назад
My character just flies up when jumping my script is exactly the same any ideas
@SpeedTutor
@SpeedTutor Месяц назад
Do you have a rigidbody on your character?
@ayon...
@ayon... Год назад
How do I create the sample scene
@SpeedTutor
@SpeedTutor Год назад
You can get that free on my website or my Unity store page :)
@Survivor_Shelter
@Survivor_Shelter 7 месяцев назад
it was 2024, and the dude is still using the crooked old system
@SpeedTutor
@SpeedTutor 7 месяцев назад
I have a video in the description where I convert this for the new input system too. I just know people use both. :)
@Survivor_Shelter
@Survivor_Shelter 7 месяцев назад
Please record a video on using the cinema machine and new input for the player, there are very few such videos@@SpeedTutor
@Artifical_Deforum
@Artifical_Deforum Год назад
Something I don't see any of in the store particularly are collision detection Universal script able objects Such as adding a single lightweight script to an object that allows inspector driven collision and layer check testing An often annoying code I have to write in almost every game Is detection One way or another A player almost always needs to detect when something has been touched under a given circumstance Whether it be a restart loop for a sidescroller on hitting a wall Or Detecting ground layer so players can be set in real time not to fall through floors or pass through walls Or A damage detection for weaponry in an rpg Or Bullet hit and which object it came from Or Raycast hit output and origin for enabling ui or other objects interactions etc. There's probably some obscure versions out there pertaining to at least one use case but seldom do I ever find an asset which has a single user friendly script that handles these cases. Ima await your reply and if you confirm to me this is the case I may build one for sale on the store. Itl be my first asset.delivery to unity And if I do end up making it I'd love to give it you for free in exchange for your feedback
@SpeedTutor
@SpeedTutor Год назад
I'm not an expert of what's found on the stores honestly, there are a lot of different options when it comes to the physics integration but I think if you want to create it - Go for it, because everyone needs more options. Even if you think someone else does it or may do, do it the best you can and it could be extra income for you. Definitely use your skills and I'll happily look at yours, when you're done! :)
@Artifical_Deforum
@Artifical_Deforum Год назад
@@SpeedTutor cheers I'll do this
Далее
Unity 7 Has ALL THESE FEATURES?! (Unity Roadmap 2024)
12:14
When Khabib dropped Conor McGregor 👀 #nocommentary
00:59
[Unity] First Person Controller [E01: Basic Controller]
20:51
Dear Game Developers, Stop Messing This Up!
22:19
Просмотров 719 тыс.
I Made a Game Using ChatGPT
9:51
Просмотров 2,7 млн
How I Made a Satisfying FPS Controller
4:38
Просмотров 139 тыс.
Unity Architecture - Composition or Inheritance?
16:24
Unity 3D - New Input System, First Person Control
33:44
Programming portals for my DOOM-style FPS
17:15
Просмотров 217 тыс.
Optimizing my Game so it Runs on a Potato
19:02
Просмотров 621 тыс.