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! 🚀🎮
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?
@@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
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.
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
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;
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
@@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.
@@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
@@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.
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
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! :)
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.
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)
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?
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.
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
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.
➡This Controller with the New Input System: ua-cam.com/video/b0AQ6IENZFg/v-deo.html
🔥Unity Sales: bit.ly/UnitySalesHub
🔥SpeedTutor Unity Store: bit.ly/STUnityStorePuzzlePacks
🔥HUMBLE SAVINGS: bit.ly/HumbleBundleDeals
Simply sublime base controller. Best one I've ever gotten from youtube.
I'm really happy that you found it useful! :) Good luck with your project too! :)
Love your tuts! Your voice and accent are great ;)
Thanks David, I really appreciate it my friend! :)
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! 🚀🎮
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?
@@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
Thanks!
You're very welcome and I appreciate the kind thanks! :) How did you find me?
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.
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
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
@@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.
@@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
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).
It's amazing that you're here and learning! Thanks for coming to watch, my friend! :)
@@SpeedTutor Your welcome Matt. Keep up the good work and time you put in these tutorials. :)
Amazing guide. You are my Hero!
You're very welcome, my friend! :D What are you creating?
@@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.
I'm glad I could help you out! Best of luck with your college project.
Keep up in this 🔥 I will follow along
Thanks, I hope you find it useful! :)
Great tutorial!
Thanks for checking this out! :)
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
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! :)
thanks for your valuable videos
You're very welcome, thanks for coming along to watch it! :D
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.
Thanks very much for the suggestions, I'll see what I can do! :)
sorry, I can not understand about speed = transform.rotation* speed in 5:52. i comment this line. it looks object's moving well.
Awesome, I'm glad its up and running :)
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)
Are you missing any references in the inspector?
@@SpeedTutor yep changed camera tag to "maincamera"
thank you you are the best
You're very welcome! :)
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?
underrated
Did you find it useful?
If you haven't done already, could you make a 3rd person controller also? Clean and clear tutorial again, thanks
I actually have a couple of tutorials in my description about that actually! :)
Landing sound after jumping... neeed
Good video, can it be used to handle slopes?
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.
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?
I'm not sure without seeing some of the code, did you put the jumping method in the correct place?
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
what happen if its the same like person and a vehicle? or will i have to rewrite script but reducing certain things?
I'm not sure what you're asking?
@@SpeedTutorhaving different character types for this script to work with
Can you make a tutorial for movement by touch input and virtual joystick 🕹
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.
That's pretty cool, I always recommend Rewired because it does it all without issue :)
My character just flies up when jumping my script is exactly the same any ideas
Do you have a rigidbody on your character?
How do I create the sample scene
You can get that free on my website or my Unity store page :)
🔥🔥🔥
Thanks man! :)
it was 2024, and the dude is still using the crooked old system
I have a video in the description where I convert this for the new input system too. I just know people use both. :)
Please record a video on using the cinema machine and new input for the player, there are very few such videos@@SpeedTutor