FPS Controller with Unity's New Input System

  Рет қаралды 67,289

Practical Programming

3 жыл бұрын

Learn how to make an FPS controller using Unity's new input system. We will cover horizontal movement, jumping, and custom gravity in this tutorial, and I will explain what everything does along the way.
Download the Final Project on GitHub: github.com/SK-Studios/FPS-with-New-Input-System
----------------------------- Contents -----------------------------
0:00 Introduction
0:20 Installing the New Input System Package
2:22 Player Setup
4:30 Input Actions Setup
7:30 Getting Input from the Player
10:00 Horizontal Movement
13:20 Custom Gravity
16:25 Jump
18:55 Mouse Look
25:20 Cleaning Up the Scripts

Пікірлер: 236
@TheDropdeadZed
@TheDropdeadZed Жыл бұрын
For anyone having issue with the "isGrounded" check, this is what worked for me: float halfHeight = controller.height * 0.5f; var bottomPoint = transform.TransformPoint(controller.center - Vector3.up * halfHeight); isGrounded = Physics.CheckSphere(bottomPoint, 0.1f, groundMask); I found this on a Unity help forum. Basically "transform.position" for the capsule collider appears to give you the bottom of the cylinder portion of the capsule object, when we want to draw the sphere at the bottom of the hemisphere part of our collider. The code above draws the sphere at the very bottom of the object meaning it will actually perform the grounded check. No disrespect to the video creator as this may have just been me and many others making a stupid mistake leading to the method in the video not working, but since this is a common many people seem to be having I hope this can help some of you!
@TheRealKaiProton
@TheRealKaiProton Жыл бұрын
I had trouble with that, and Added an Empty Game object, called Ground check, at the bottom of the player Capsule, then used its position to figure out the bool
@TheBeLuvdTRex
@TheBeLuvdTRex 8 ай бұрын
I was getting so heated trying to figure out how to get it to detect from the bottom thank you.
@tyb.c.4332
@tyb.c.4332 3 жыл бұрын
A fantastic adaptation of the Brackeys vid, but with the new input system. Definitely subbing! :)
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
Thanks!!
@zombitek0941
@zombitek0941 3 жыл бұрын
You know it is a good day when (SK) Practical Programming releases a new video
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
Haha thanks! 🤣😁
@ekokataatheplacetobe9540
@ekokataatheplacetobe9540 Жыл бұрын
Thank you, your mouse clamp implementation was exactly what i needed. Godsent.
@FeiOTV
@FeiOTV 3 жыл бұрын
I lost almost two days trying to make a good walk with this new system. i learnt how it works so, now i can improve it a little bit. i loved you video! Thank you for sharing!
@FeiOTV
@FeiOTV 3 жыл бұрын
I mean, a lot of videos and tutorials incomplete, i didnt know two steps you showed how to do it, and now i can keep with my fun ty!
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
You're most welcome!! I'm glad I could help :))
@o.429
@o.429 3 жыл бұрын
Great Tutorial. Thank you, I am waiting for more.
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
Thanks! More will be coming out sometime in the next few weeks, so stay tuned 😁
@yudnai5577
@yudnai5577 3 жыл бұрын
I like it. so to the point without the extra talking around so you can focus and learn. very amazing job.
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
Thanks! I'm glad you liked it :)
@yudnai5577
@yudnai5577 3 жыл бұрын
@@PracticalProgramming can it work with WebGL touch ?
@xenstudio
@xenstudio 3 жыл бұрын
this tutorial about the new input system is a lifesaver
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
Haha thanks :) I'm glad it helped
@chetansaini2843
@chetansaini2843 2 жыл бұрын
Damn bro you explain each and everything so well.
@tastypatrick2903
@tastypatrick2903 Күн бұрын
I was able to follow this tutorial pretty fast, but damn the values you set for sensitivity are crazy. I need my sensitivity X over 100 in order to look around normally. Guess that just depends on your system, and it works really great after finetuning the values, that's the power of the Unity editor after all. Thanks for the video!
@MystiqMiu
@MystiqMiu 2 жыл бұрын
Big Thumbs UP!! I'm in a class for Unity atm and it just takes certain instructions for me to understand things! This was the absolute best on the new Input System for me!! Thanks for making this!!
@owenp013
@owenp013 3 жыл бұрын
A tutorial that actually makes sense to me?!? Wow! This was the first tutorial that actually went into detail for first person movement with the new input system. I had watched other videos on the system, but none of them helped me with the movement until this video!
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
Haha thanks for the great feedback :)) I'm glad it helped!!
@AetherXIV
@AetherXIV 3 жыл бұрын
great tutorial man. You didn't explain always what you did, but I'm pretty sure that would make for a long video! I'm intermediate level and I think I understood what you were doing. Thank you for the tutorial!
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
Thanks! It can sometimes be a bit difficult to find a balance between showing how to make something work and explaining how it works, but if you have any question or would prefer it if I went into more/less detail please let me know since that feedback lets me know how I should modify my content. Cheers again :)
@AetherXIV
@AetherXIV 3 жыл бұрын
@@PracticalProgramming I wouldn't change anything man. if wanted to add an "explanation" bit to the script it could even be a separate video that those interested could watch. "check out this linked video if you want to learn why this code works and my thought process" (then you walk through the code). That might not even be necessary most times though. So far everything you've done has been comprehensible to me except I'm not as good with the math functions you use. I'm subbed and will be checking the channel
@noahtuneslaunchpad678
@noahtuneslaunchpad678 3 жыл бұрын
Woah, a new channel. Sick
@ripscru8032
@ripscru8032 3 жыл бұрын
Awesome tut
@fateshow5303
@fateshow5303 2 жыл бұрын
really helpful thanks
@vargasxr421
@vargasxr421 2 жыл бұрын
Again Really Well Done! Very appreciated!
@PracticalProgramming
@PracticalProgramming 2 жыл бұрын
Thanks, and you're welcome :)
@2Asspie
@2Asspie Жыл бұрын
Thank you so much
@conandev3710
@conandev3710 2 жыл бұрын
Thank you very much.
@anticstudios
@anticstudios 2 жыл бұрын
okay you are offiacly amazing im making a local multiplayer game and this is really well done
@IvanZhiryakov
@IvanZhiryakov 3 жыл бұрын
Wow, that's one of the cleanest and clearest explanation videos on that topic I've seen lately. Great work!
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
Thanks! I'm glad you found it helpful :)
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
What video are you talking about? I can assure you I didn't just copy someone else's work
@MatheusTviegas
@MatheusTviegas 3 жыл бұрын
Thank you so much for that video! new subscriber!
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
You're welcome, and thanks!!
@mboe94
@mboe94 3 жыл бұрын
This is seriously one great series of tuts - well done mate. My view is however moving at all times. If I remove my hand from the mouse, it keeps going - which is ruining it for me :p Any ideas? On a side note: for me, the tutorial would've been more helpful if the scripts were separated.
@F00dstamp96
@F00dstamp96 2 жыл бұрын
Awesome guide!!! Best one i found on the new input system. Keep up the great work man!
@TheRealKaiProton
@TheRealKaiProton 2 жыл бұрын
My unity Version is 2020.3.22f1, in the Actions, New 2D Vector composite, was not showing, but it turns out its actually "add Up/Down/Left/Right Composite"
@nagyFerko
@nagyFerko 2 жыл бұрын
Hi! It was a great video, however i have a little issue with the rotation. atleast one axis of the mouse delta always gives more, or less then 0, even when i let the mouse, and the cursor not moving at all. Tired to find the solution, but i'm hopeless now.
@2ksnakenoodles
@2ksnakenoodles 3 жыл бұрын
How would one hook up mouseLook to the right stick on a gamepad?
@yester8946
@yester8946 3 жыл бұрын
For some reason, my camera is snapping even though it's a float and it only happens if I add delta time
@idcemail123
@idcemail123 Жыл бұрын
Hello, how do you make the x and y sensitivity the same speeds? Also when turning horizontal mouse it is extremely hard to keep it going straight in one direction without the y value jumping a lot. anyway to fix this and make it easier to do this?
@meeperhere
@meeperhere 2 жыл бұрын
1,08K!? Give this guy more subs!
@PracticalProgramming
@PracticalProgramming 2 жыл бұрын
Haha thanks!! Slow and steady does it :)
@ShyMan1725
@ShyMan1725 2 жыл бұрын
Great tutorial!!!! a complement, you sound like Stephen Hawking and that's cool!
@DAAugerman
@DAAugerman 2 жыл бұрын
Great tutorial was easy to follow and exactly what I needed thanks.
@devlog98
@devlog98 3 жыл бұрын
Thanks for the tutorial! It was very, very complete and worked like a charm!
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
You're welcome :)
@captaincookies7222
@captaincookies7222 2 жыл бұрын
@@PracticalProgramming when I try to add a 2D vector composite (5:53) a 2D vector Composite option doesn’t show up why is this(I know I’m a bit late but it’ll help out)
@captaincookies7222
@captaincookies7222 2 жыл бұрын
@@PracticalProgramming would a up/down/left/right composite work instead
@goodmornin7524
@goodmornin7524 2 жыл бұрын
is this (groundMovement.[action].performed += context => do something) used instead of using the event callback of the input system?
@gonchi2610
@gonchi2610 Жыл бұрын
great video!! How can I make the character have momentum? like not stopping so suddenly when I stop pressing wasd
@jackalworks6939
@jackalworks6939 2 жыл бұрын
How do you go about counting game objects as ground so you can jump on a cube?
@nunomonteiro9808
@nunomonteiro9808 Жыл бұрын
I need some help.... I did exactly the same thing as he did, but my gamepad right joystick sensitivity on X is slower than Y... I tried to put the same value on each of them, and it gives me the same result. The X sensitivity is slower than Y sensitivity....
@kenmurphy5485
@kenmurphy5485 2 жыл бұрын
Excellent tutorial. Will definitely continue to follow you. Thank you so much!
@PracticalProgramming
@PracticalProgramming 2 жыл бұрын
Thanks! I'm glad I could help :)
@adrainmunteanu125
@adrainmunteanu125 2 жыл бұрын
When you move both the player and rotate the camera, there is some jitter going on. Now I've seen people saying that it is because of having on thing in FixedUpdate() and another in Update(), but here they are both in Update() and it is still happening. Any ideas on how i can get rid of it? Please help
@shaiookami5756
@shaiookami5756 3 жыл бұрын
how i can set smooth input and sensitivity?
@kardokdelikaya9570
@kardokdelikaya9570 Жыл бұрын
Hey, I added things like Reload, heal, shoot kinda stuff to same action map. But when I do that character doesn't move with W-A-S-D and arrows but it moves with gamepad. If I remove them character moves with keyboard. How can I fix that?
@gambe96
@gambe96 2 жыл бұрын
My ifGrounded doesn't work correctly ? When I set it to a low value, (ex: 0.1) I can't jump at all. When I set it to a high value (ex: 3), of course the capsule floats, and seems to phase through the ground, requiring multiple space presses (each rising the player a little bit) before being able to jump. Capsule scale 1, 1, 1. Character scale 1, 1, 1. What could cause that ? Is it not placed correctly ? Is it placed at the center of the character ?
@Rajesh-ey3qr
@Rajesh-ey3qr 2 жыл бұрын
when i want to make mouseX and MouseY it showed error but when i use for movement or Jump it didnt showed this error I also created MouseX and MouseY actions groundMovement.MouseX.performed+= ctx => mouseInput.x = ctx.ReadValue(); Severity Code Description Project File Line Suppression State Error CS1061 'PlayerControls.GroundMovementActions' does not contain a definition for 'MouseX' and no accessible extension method 'MouseX' accepting a first argument of type 'PlayerControls.GroundMovementActions' could be found (are you missing a using directive or an assembly reference?) Assembly-CSharp E:\Unity\Projects\Actual\Assets\Scripts\InputManager.cs 24 Active
@duudiiss
@duudiiss 3 жыл бұрын
can I use the same input manager for different things? Like shotting, use key, communication keybindings, etc
@PracticalProgramming
@PracticalProgramming 2 жыл бұрын
Yes you can! That's the great thing about the new input system. Here I have just set up a base from which you can expand on to do many more things - this is very similar to the input system I used in my own action survival shooter game :)
@sadicus
@sadicus 2 жыл бұрын
Got as far as 22:51 what does it mean when drag/drop the Mouse Script to the "Input Manager Mouse Look slot" but it will not accept it? No errors or syntax issues reported. My guess is that somehow MouseX and MouseY are not suppose to be connected to GroundMovement but this is my fisrt script so not sure, ~ Cheers
@thegameguy208
@thegameguy208 3 жыл бұрын
Is it possible to add acceleration and friction to our movement?
@HiHoSHOW
@HiHoSHOW 2 жыл бұрын
For some reason, when I look left and right the camera movement is jittery, not smooth and very slow. Unlike when I look up and down it works perfectly. How can I fix this? pleasse help
@juanpineda4961
@juanpineda4961 Жыл бұрын
Ty a lot, the way you explain and build the scripts is really awesome, it let me add more controllers without any issue. Great job. Keep it up.
@PracticalProgramming
@PracticalProgramming Жыл бұрын
Glad it helped!
@HptmAtomiK
@HptmAtomiK 2 жыл бұрын
Heyo, the mouse movement is not being registered at all. Triple checked my code and it is exactly the same as in the video, all capitalisations are correct. Yet when I press play and try moving the mouse to look it does nothing.
@tbunreall
@tbunreall 2 жыл бұрын
how do you make it so the x and y sensitivity are the exact same? They aren't and it feels weird.
@readthis7797
@readthis7797 3 жыл бұрын
So I want to import this onto a new project, but I do not want the gun. I only made the player and imported everything, but not the gun script. Once I did, I got this error 'Assets\Player\InputManager.cs(9,22): error CS0246: The type or namespace name 'Gun' could not be found (are you missing a using directive or an assembly reference?)'. And when I remove that line of code, I get another error 'Assets\Player\InputManager.cs(44,40): error CS0103: The name 'gun' does not exist in the current context'. So when I remove that, there are no errors and when I test it, nothing works. Can you please help me? I am new to unity.
@johnriendeau5301
@johnriendeau5301 2 жыл бұрын
If your having issues with jumping change the isGrounded = Physics.CheckSphere to Physics.CheckSphere(new Vector3(transform.position.x, transform.position.y - 1f, transform.position.z), 0.1f, groundMask); The issue stems from the pivot point being in the center of the player.
@vandentkong9000
@vandentkong9000 Жыл бұрын
thanks alot, does that mean the player could not detect the ground layer mask because it is higher?
@alainthenot2309
@alainthenot2309 Жыл бұрын
Thanks mate
@davidcalderwood7041
@davidcalderwood7041 3 жыл бұрын
How should I go about adding a sprint mechanic? I have a groundMovement.Sprint.performed += _ => movement.OnSprintPressed(); Then in my movement script I have a pressed function that sets sprinting to true. How should I go about setting it to the update method and only call it when the button is being held down? Right now when you press it you sprint, but releasing the button does not slow you back to the normal walk speed.
@robbieboyable
@robbieboyable 3 жыл бұрын
in Update or FixedUpdate, wherever your movement is being updated just do `if (isSprinting) { speed = 20f;}` or double your speed
@Khoura
@Khoura 3 жыл бұрын
Nice video bro, how would you add a head bob?
@oliverb.8995
@oliverb.8995 3 жыл бұрын
Shake the camera.
@elrymoe
@elrymoe 2 жыл бұрын
the expression body you do to receive the input is no longer working.
@michaelcarman6513
@michaelcarman6513 2 жыл бұрын
I'm not sure if there has been an update to the new input system since this video but when I implement the code exactly as shown in the video my mouse look will not stay stationary when not moving the mouse. It continues to "drift" in the last direction, constantly in motion no matter which way i look (up/down, left/right). Anyone else having this effect? And is there a known reason?
@nagyFerko
@nagyFerko 2 жыл бұрын
I had the same, and just found the solution. if you still need help, then here it is! you need these 2 line: groundMovement.MouseX.started+= ctx => mouseInput.x = ctx.ReadValue() ; groundMovement.MouseX.canceled+= ctx => mouseInput.x = ctx.ReadValue() ;
@lololollolololo7077
@lololollolololo7077 3 жыл бұрын
everything works perfectly ! except you are not able to jump on slopes witch is very annoying have you solved this issue for yourself if so please share
@Jax306
@Jax306 2 жыл бұрын
I was trying to add a Run or Sprint option to this and i am failing. please help
@ruslan_yefimov
@ruslan_yefimov 2 жыл бұрын
Wait... Is it necessary to multiply mousedelta by deltaTime? Seems strange to me
@ECCDamianBerek
@ECCDamianBerek 2 жыл бұрын
soo if you keep pressing space you can fly lol . did all the same and somehow my player falls down very slow until i hit gravity at -400 but jump doesnt look natural at all
@rawridadino1358
@rawridadino1358 3 жыл бұрын
I'm a beginner at unity at i failed the roll-a-ball tutorial bc i couldnt find the input system :(
@JuliXR525
@JuliXR525 2 жыл бұрын
Hi! The first time when I followed the instructions of video all was OK but now in the Script there is a Data Type called "PlayerControls" VS and Unity put in red this like error and now I did change that for "PayerActions" and all is ok, if you are using Unity 2020.3.21f may be you have to make this change and that code piece would be: PlayerActions controls; PlayerActions.GroundMovementActions groundMovement; For example, this is exactly same, thanks for attention.
@imdublin4431
@imdublin4431 3 жыл бұрын
you wrote Vector2 horizontalInput; class without "private" or "public", so does the blank means public or private?
@tlgaming3530
@tlgaming3530 3 жыл бұрын
I think it means private but i am not sure
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
Yes it defaults to private when not specified :)
@randophanto3153
@randophanto3153 3 жыл бұрын
Hey there! Your tutorial is great but one thing, when you start the coding I get lost because the starting code looks different then mine ending with me being able to write the scripts but when I try and drag them on it says "The script don't inherit a native class that can manage a script".
@Faisal-jo5vk
@Faisal-jo5vk 3 жыл бұрын
just make sure that the script name matches the code name, and that there are no errors
@sekaiology
@sekaiology 3 жыл бұрын
How can I export this to import and use into other unity projects?
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
You can simply follow this tutorial in an existing project - everything will still be the same. If not, you could try copying and pasting all of the scripts and assets over
@loudris442
@loudris442 2 жыл бұрын
Can you please do a third person version of this tutorial
@namelessgaming2679
@namelessgaming2679 3 жыл бұрын
Hey I have an issue with the controls. Im using joystick inputs and everything works fine except the velocity of the character is saved so my character looks like hes ice skating.
@namelessgaming2679
@namelessgaming2679 3 жыл бұрын
Don't worry I found the solution! If anyone else experiences this, it's caused by the input manager not being set to "pass through" and "button".
@s-ata-n
@s-ata-n 10 ай бұрын
how can i add a running system to this
@neonbre
@neonbre 3 жыл бұрын
Thank you so much ! I'm a complete noob at unity and programming in general, so you really helped me get past the scary part ! I feel like I've copied someone else's work but it works like a charm !!
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
You're welcome, that's great to hear!! 😁😊
@fitness4kids330
@fitness4kids330 3 жыл бұрын
for some reason when i put the code in for the input manager it looks diffrent to yours and has alot of other code in it that i didnt put in? do you know why?
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
The default script template comes with a start and update function, if that's what you're talking about. You can just delete those and cut it down to the same as what's on my script.
@bobthebutchr1719
@bobthebutchr1719 3 жыл бұрын
Ok so when I tried to put the scripts in the player it said "Can't add script component 'Input Manager' because the script class cannot be found. Make sure that there are no compile errors and that the file name and class name match". Please help me i have found no videos to help me on this, ITS SO CONFUSSING!!!
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
Make sure the script name has no space between input and manager. The error is because the name of the script and the name of the class (near the top of the script, public class XYZ) must be exactly the same. I hope that helps :)
@TheSiskyShow
@TheSiskyShow 2 жыл бұрын
for anyone having trouble with the jump. Instead of checking "isGrounded" with physics try linking it with the character controller. isGrounded = controller.isGrounded; this will make sure you are in ground on everything you step so you don't have to layer everything.
@Unknownhalo
@Unknownhalo 2 жыл бұрын
It works Thanks
@Unknownhalo
@Unknownhalo 2 жыл бұрын
Go to the movement script and at the line you put the isgrounded code replace it with character controller.isgrounded = controller.isgrounded
@gavrielshemesh7825
@gavrielshemesh7825 Жыл бұрын
THIS ACTUALLY WORKS THANK YOU!!!
@KOOBA2137
@KOOBA2137 2 жыл бұрын
shouldnt mouseY also be multiplied by Time.deltatime?
@just_snowie
@just_snowie 3 жыл бұрын
Unity: doesn't work, with no errors to show Me: spends 3 hours looking for error and changing random parts hoping it works Me: changes 'u' on update to capital 'U' Unity: works Me: calmly gets off pc and goes to bed
@RussmanDesignHD
@RussmanDesignHD 3 жыл бұрын
Sounds like pure acceptance! lol. Capital letters always win!
@PracticalProgramming
@PracticalProgramming 2 жыл бұрын
Haha yeah the details matter, use capital letters for function names!!
@chopchop708
@chopchop708 2 жыл бұрын
This is great. I wish more tutorials were as clear and well structured as this one!
@sopothetocho
@sopothetocho 3 жыл бұрын
Great tutorial, but for some reason If use 8f on the Mouse X sensitivity is sooo slow I have to put 100f for the horizontal mouse movement to be acceptable, any idea what that would be? I checked my code like 3 times and it is identical to yours. Its not a problem but I'm just confused why would it behave differently.
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
Honestly I'm not certain what the issue is, but perhaps it could be something to do with the unity of input system version? Also it won't make a real difference in your game as you can just set the multiplier to a suitable value. If you do figure out what the issue is please drop a comment as I would be interested to know too :)
@martysdogs8
@martysdogs8 3 жыл бұрын
@@PracticalProgramming It's almost certainly a hardware difference. In the System, mouse sensitivity is directly proportional to your mouse's DPI. Rather than read the mouse inputs itself, Unity can just read the System's own measurements. I don't know if it reads those inputs raw, or if it reads them after the System's preferences modify them, but either way it would be enough to have a noticeable effect.
@aartemiswhite
@aartemiswhite 3 жыл бұрын
It happens because this mouse look scrip is frame rate dependent, so the lower your frame rate the higher the sensitivity will be. You need to remove the multiplication with Time.DeltaTime in "transform.Rotate(Vector3.up, mouseX * Time.deltaTime);" because the input is already frame rate independent and multiplying it by Time.deltaTime will mess it up.
@RussmanDesignHD
@RussmanDesignHD 3 жыл бұрын
I did 250f for Horizontal and I did 5f.
@willthunder7212
@willthunder7212 2 жыл бұрын
Will this work for a physics based controller?
@sudhakerdev
@sudhakerdev 3 жыл бұрын
How do you use the awake function in the vs code?
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
The functions can be used in any text editor, just type it out exactly as it is in the script. VS code doesn't have the same autocomplete features as visual studio, but everything still works exactly the same.
@csicee
@csicee 2 жыл бұрын
I downloaded input system but there is no option to add it to assets
@seikomega7298
@seikomega7298 3 жыл бұрын
when i try to compile inputManager it says that the type GroundMovementActions doesen't exist. please help
@mirageowl
@mirageowl 3 жыл бұрын
"GroundMovement" is what you name the ActionMaps column (check 5:20). Whatever you named that part, you will have to use it in the code. For example if you name it Character it will be CharacterActions etc.
@tamhuynh8019
@tamhuynh8019 Жыл бұрын
Dear, can you make another video for Mobile input?
@americanwieland
@americanwieland 2 жыл бұрын
I was having trouble with jumping until I moved the "verticalVelocity.y += gravity * Time.deltaTime;" & "controller.Move(verticalVelocity * Time.deltaTime);" lines to below the "if (jump) {...}" block. Otherwise controller.Move() is always called before verticalVelocity.y is updated within the "if (jump) {...}" block.
@systembreaker4864
@systembreaker4864 2 жыл бұрын
U saved my day 🙇🙇🙏🏻🙏🏻🙏🏻😭
@m13sch13f
@m13sch13f 9 ай бұрын
thank you man non other solution work for me but urs did😁
@nukeprsmf1738
@nukeprsmf1738 2 жыл бұрын
so when i put in PlayerControls my game says it not found any advice or could you tell me how to fix this
@SilverSterling5
@SilverSterling5 27 күн бұрын
You might have already fixed this a long time ago, but you must name it whatever the name of the generated C# Script you named when you made the New Input Actions. capitals and spaces included. For Example, When I generated it, I named it "FPSControl", so when he puts up the "PlayerControls" in his script example, I just substituted it for what I named it, which is "FPSControl".
@LesP56
@LesP56 3 жыл бұрын
Problem, anyone know what I've done incorrectly? I'm about halfway through the video and when I press "W", I go forward and do not stop when I release it; same with the other keys. I keep going in reverse if I press "S" and so forth.
@LesP56
@LesP56 3 жыл бұрын
I must be doing something incorrectly. I got a bit further in the vid and cannot jump. Hmmm. I keep going over the early part of the vid and it looks as though I'm doing everything properly. The only difference is that I'm using Unity 2020.3.8 but in my view that is unlikely to cause the problem. Anyone?
@dougmcclunie8178
@dougmcclunie8178 3 жыл бұрын
@@LesP56 I've got the same issue
@dougmcclunie8178
@dougmcclunie8178 3 жыл бұрын
I fixed it by changing the horizontal movement action type from a button to a passthrough 5:30 , and i couldn't jump because my character wasn't getting grounded
@artucus2
@artucus2 3 жыл бұрын
@@dougmcclunie8178 Thank you so much! Changing the horizontal movement action type from a button to a passthrough solved my issue as well. As for the grounded issue, check out GF reply to Crimson Embers comment from 2 months ago "had this same problem the fix is just to have the spheres center begin at the feet of the player like so: Physics.CheckSphere(transform.position - (new Vector3(0, transform.localScale.y, 0)), 0.2f, groundMask)" (i made mine 0.1f vs 0.2f)
@xrcloud9590
@xrcloud9590 2 жыл бұрын
the 2d vector composet doesnt show up for me
@Platonyx
@Platonyx 3 жыл бұрын
i dont see the down arrow where you say to create input actions??? why does it do this?
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
If you mean when I create the asset in the Project view, the down arrow will only appear if your screen is too small to fit the entire menu in. If you followed the first part of the tutorial and installed the Input System package, Input Actions will be an option near the bottom of the context menu.
@FlavourKSmack
@FlavourKSmack 3 жыл бұрын
I have an issue with setting up the gravity and jumping, it just doesn't work for me. i have done everything verbatim and it just does not work, it detects the input, (i checked with debug log in the onjumppress function) but it doesn't seem to change the vertical velocity at all. if i disable the "if isgrounded, set velocity to 0" the jump works but the gravity obviously keeps increasing. is there any way i could fix this?
@FlavourKSmack
@FlavourKSmack 3 жыл бұрын
nevermind, fixed this with an invoke
@iampiggy2838
@iampiggy2838 3 жыл бұрын
@@FlavourKSmack how did you fix it? im having the same problem
@FlavourKSmack
@FlavourKSmack 3 жыл бұрын
@@iampiggy2838 sorry for the late response! my fix was incredibly scuffed, and probably isn't very good in the long run, as i am only a beginner, but basically what i did was i added a new method which changed a bool variable to true. that method was called in the OnJumpPressed() method, so it would look like this: private void onJumpWait() { isGroundedWait = true; } public void OnJumpPressed() { Invoke("onJumpWait", 0.1f); jump = true; } afterwards, i changed the if statement to if (isGrounded == true && isGroundedWait == false) { verticalVelocity.y = 0; } i don't know if this helps at all, but if i wasnt clear or something i'd be happy to try and explain myself better
@captaincookies7222
@captaincookies7222 2 жыл бұрын
Is a up/down/left/right composite the same as a 2D vector composite
@amanumonster2213
@amanumonster2213 2 жыл бұрын
yeah
@arampia9836
@arampia9836 2 жыл бұрын
I'm confused? I created all the scripts for movement, yet, I can't add two of them, both the MouseLook and Movement, because of the fact that it has nothing to do with the script inside. Why is that?
@arampia9836
@arampia9836 2 жыл бұрын
Just to note. Sorry, I figured out the problem.
@crimsonembers8741
@crimsonembers8741 3 жыл бұрын
thanks for the tutorial but I'm having a problem, despite adding "isGrounded = Physics.CheckSphere(transform.position, 0.1f, groundMask);" it still wont ever define isGrounded as true (I confirmed this code is the problem with debug messages)
@o.429
@o.429 3 жыл бұрын
Choose the ground, add a layer to it for example named ground. Add this layer to your layermask at the inspector of your player.
@crimsonembers8741
@crimsonembers8741 3 жыл бұрын
@@o.429 thanks but it didn't work, i troubleshooted some more and I think the sphere is coming from the center of the player instead of the base/bottom
@Apature
@Apature 3 жыл бұрын
​@@crimsonembers8741 I had the same issue... I have solved it by making the CheckSphere radios 2f. I don't know why its different to the video.
@gf408
@gf408 3 жыл бұрын
@@crimsonembers8741 had this same problem the fix is just to have the spheres center begin at the feet of the player like so: Physics.CheckSphere(transform.position - (new Vector3(0, transform.localScale.y, 0)), 0.2f, groundMask)
@artucus2
@artucus2 3 жыл бұрын
@@gf408 Thank you! Your solution resolved my issue as well.
@cryptic7387
@cryptic7387 3 жыл бұрын
For [SerializeField] Movement movement; it says that "Movement" does not exist in the current context can you help me with that?
@flowerpower111
@flowerpower111 3 жыл бұрын
I have the same issue. Did you find a solution?
@lejocarry
@lejocarry 3 жыл бұрын
@@flowerpower111 Check the Movement.cs It should start with : public class Movement : MonoBehaviour
@orlandosantosjunior7720
@orlandosantosjunior7720 3 жыл бұрын
@@lejocarry My Movement.cs start with public class Movement : MonoBehaviour but the Movement property do not appear
@lejocarry
@lejocarry 3 жыл бұрын
@@orlandosantosjunior7720 recheck with thhe video. If you're only one with this error, it's your mistake ;)
@orlandosantosjunior7720
@orlandosantosjunior7720 3 жыл бұрын
@@lejocarry I found the problem, The External Script Editor was not setup for Visual Studio Community. Tks for the support.
@eriksjud9465
@eriksjud9465 3 жыл бұрын
Nice script, but just 1 quick question. Arent you supossed to always put everything related to physics(movement, jumping, etc) in the FixedUpdate() ? Thats how I always had it explained to me.
@i6528
@i6528 2 жыл бұрын
The jumping doesn't work and I can't find the problem.. does anyone else have the same problem?
@susansbeans5693
@susansbeans5693 2 жыл бұрын
How does he get all those suggestions
@farhanhakim2189
@farhanhakim2189 3 жыл бұрын
Can you please make a tutorial about checking if the file is exists using System.IO?
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
Right now I have a bunch of other videos planned for the coming weeks, as once school starts I won't be able to make content as frequently so I made a lot in advance. Once those are released though, I will certainly keep that in mind. (I already put it on my to do list 😉). Thanks for the suggestion!
@farhanhakim2189
@farhanhakim2189 3 жыл бұрын
@@PracticalProgramming well im sorry, i fixed it by myself tho 😂
@farhanhakim2189
@farhanhakim2189 3 жыл бұрын
@@PracticalProgramming im not gonna charge you by my request 😊
@PracticalProgramming
@PracticalProgramming 3 жыл бұрын
Haha no worries - I'm glad you figured it out!
@storekeep
@storekeep 2 жыл бұрын
My up and down sensitivity is much higher than my left and right sensitivity and is way more sensitive. How do I make them the same?
@PracticalProgramming
@PracticalProgramming 2 жыл бұрын
Hi storekeep, that is what the sensitivity x and y are for - simply increase or decrease those values until you are happy with them :)
@tbunreall
@tbunreall 2 жыл бұрын
@@PracticalProgramming That's a little unscientific no? Is there no way to match them,?
@mp-rayhanauliasw8867
@mp-rayhanauliasw8867 3 жыл бұрын
hi, in the custom gravity part, i can't found my ground in the ground mask layer (inside the editor in Unity)... i can't change the ground mask to ground (because it is not there) how to fix that ? thank you :)
@ethanswaidner2868
@ethanswaidner2868 3 жыл бұрын
Ground is a custom layer. To create a custom layer, you go to the dropdown layers menu in the top right of the screen, click edit layers, drop down the layers tab in the inspector, and then type in ground in an empty layer slot. After that, ground should be visible when setting the layer of an object. Hope that helps!
@mp-rayhanauliasw8867
@mp-rayhanauliasw8867 3 жыл бұрын
@@ethanswaidner2868 thank you, it helps... but now the problem i face lies in the jump :( i've followed all the steps but it doesn't work. Perhaps you know how to solve this ? :(
@kreativekendi4267
@kreativekendi4267 3 жыл бұрын
@@mp-rayhanauliasw8867 the jump doesnt work? Same for me idk why
@kreativekendi4267
@kreativekendi4267 3 жыл бұрын
@@ethanswaidner2868 everything else works though
@mp-rayhanauliasw8867
@mp-rayhanauliasw8867 3 жыл бұрын
@@kreativekendi4267 yeah the jump doesnt work :(
@s.s.scriptties
@s.s.scriptties 3 жыл бұрын
i don't have it as one of my packages
@kingclassic2231
@kingclassic2231 2 жыл бұрын
i cant download input system, when i type that, nothing shows
@Nico-eq3rf
@Nico-eq3rf 2 жыл бұрын
make sure you are searching from unity registry, not from in project. you can see this from left up corner (Packages)
@greenstargaming4745
@greenstargaming4745 2 жыл бұрын
GroundMovementActions is not a part of PlayerControls for me
Получилось у Миланы?😂
00:13
ХАБИБ
Рет қаралды 4,5 МЛН
Nastya and SeanDoesMagic
00:16
Nastya
Рет қаралды 36 МЛН
Llegó al techo 😱
00:37
Juan De Dios Pantoja
Рет қаралды 57 МЛН
Mom's Unique Approach to Teaching Kids Hygiene #shorts
00:16
Fabiosa Stories
Рет қаралды 35 МЛН
Получилось у Миланы?😂
00:13
ХАБИБ
Рет қаралды 4,5 МЛН