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; 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
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! :)
@@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.
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)
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
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?
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.
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
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! :)