Easy 3D Top Down Unity Game Development Tutorial (New Input System)

Поделиться
HTML-код
  • Опубликовано: 13 ноя 2022
  • Easily create an advanced top-down controller that works for all platforms with Unity's new input system! Learn to make a movement script that allows you to navigate your world in this beginner-friendly Unity game development tutorial. You will learn how to make a game using the Unity game engine and be able to use it in your future game dev career.
    📱Check out my mobile game Pair E'm!
    👉 Apple Store: apps.apple.com/us/app/pair-em...
    👉 Play Store: play.google.com/store/apps/de...
  • ХоббиХобби

Комментарии • 97

  • @badbanana2547
    @badbanana2547 Год назад +33

    Is there a way to make the rotation stay after you let go of the joystick? My character always snaps back to its default rotation

    • @atomiccs
      @atomiccs  Год назад +23

      Thank you for catching that I will implement this into the next video!
      Put the rotation line of code within an if statement checking if movement does not equal zero like this ->
      if(movement != Vector3.zero)
      {
      transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(movement), 0.15f);
      }

    • @badbanana2547
      @badbanana2547 Год назад +3

      @@atomiccs thanks!

    • @maiconsantana6995
      @maiconsantana6995 Год назад

      I did if(move.x == 0f && move.y == 0f) return; first line of MovePlayer method, works... make not the best way

    • @batistedachary1439
      @batistedachary1439 Год назад

      @@maiconsantana6995 if(move.Equals(Vector3.zero)) ;)

    • @o7squash
      @o7squash Месяц назад

      @@atomiccs dawg you are a LIFESAVER omg

  • @El-Iks
    @El-Iks Год назад +18

    Painfully underrated tutorial

  • @austincottle6789
    @austincottle6789 Год назад +5

    Incredibly designed tutorial, it's exactly as detailed as it needs to be and it's super concise. I hope you keep making more stuff!

  • @orchard800
    @orchard800 Год назад +4

    Thank you so much for creating such a clear, concise tutorial. Just what I was looking for.
    Ps. I'd recommend putting camera follow in Late Update as well to avoid any jitter.

  • @SirSone7
    @SirSone7 Год назад +2

    Helped me a bunch, amazing tutorial
    Hope you keep it going

  • @RobertoMolero-pc7tv
    @RobertoMolero-pc7tv 7 месяцев назад

    Brooo you made in 16 minutes what it took me 6 months to learn... Totally underated tutorial. ❤❤❤❤ Gettings from Perú

  • @M1kaTck
    @M1kaTck Год назад +8

    Great vid!
    If anyone wants to get rid of the additional speed when going diagonally, modify this line to keep the movement magnitude at 1:
    Vector3 movement = new Vector3(move.x, 0f, move.y).normalized;

  • @thatGuy-jn2lt
    @thatGuy-jn2lt 9 месяцев назад +6

    Never thought a lightmode-user would make something so helpful.

  • @lionvstuna4015
    @lionvstuna4015 5 месяцев назад

    This tutorial is fantastic, you deserve more subscribers

  • @myrez_
    @myrez_ Год назад +1

    thank you so much! been trying to get this right for hours

  • @TheRakuSama
    @TheRakuSama Год назад +15

    To stop the rotation from return to its original rotation, I simply made it like this:-
    if (move.sqrMagnitude > 0.1f)
    {
    Vector3 movement = new Vector3(move.x, 0f, move.y);
    transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(movement), 0.15f);
    transform.Translate(movement * speed * Time.deltaTime, Space.World);
    }
    Hope this helps 😁😁

    • @atomiccs
      @atomiccs  Год назад +3

      Another great way to do it!👍

  • @guilhermekaercher1624
    @guilhermekaercher1624 Год назад +1

    Simply awesome my man, thanks!!!!

  • @robbybobbijoe
    @robbybobbijoe Год назад +2

    Thank you man, this was really cool! I'm using 2 players, one controller and one keyboard so I just made one script for each of them.

    • @atomiccs
      @atomiccs  Год назад +1

      Awesome so glad to hear how it helped you out!

    • @robbybobbijoe
      @robbybobbijoe Год назад

      @@atomiccs I’m currently trying to figure out how to make my bullets bounce on walls on my 3D game…

  • @josephc-mg2tk
    @josephc-mg2tk Год назад +2

    All of the unpopular channels are sometimes gold

  • @sevovideo
    @sevovideo Год назад +5

    If anyone have problem with collision detecion while you using character controller, try this:
    public CharacterController controller; //sign gameobject player with character controller
    in movePlayer()
    change transform.Translate(movement * speed * Time.deltaTime, Space.World);
    into controller.Move(movement * speed * Time.deltaTime);
    Btw great tutorial :)

    • @atomiccs
      @atomiccs  Год назад

      Awesome addition thank you!

    • @BasterThanLight
      @BasterThanLight Год назад

      I tried this and now collisions look better, but my character does not have gravity anymore (I was using a rigidbody before). How can I make it fall?

  • @albertolanataable
    @albertolanataable 10 месяцев назад

    Great Video! thanks a lot!

  • @whellintonrocha8734
    @whellintonrocha8734 Год назад +2

    I think this is the first time in years i see someone writing codes in light mode.

  • @dcg4847
    @dcg4847 Год назад +1

    Great Video

  • @ayotundeayoko5861
    @ayotundeayoko5861 7 месяцев назад

    many thanks -works like a charm

    • @ayotundeayoko5861
      @ayotundeayoko5861 6 месяцев назад

      for me, I didn't use the entire tutorial, just bits I needed to make my movement work; @@piotrmontgomerytv7786

  • @michalturlik7309
    @michalturlik7309 6 месяцев назад

    Hi thank you so much :) Is there any way to let the camera rotate around the target preserving the lookAt angle by pressing Q and E keys?

  • @DrakonFirestone
    @DrakonFirestone Год назад

    If I'm using keyboard to steer the player, the turning is really snappy, what can I do to smooth it even with keyboard controls?

  • @yyydotgh
    @yyydotgh 11 месяцев назад

    Hi! Thanks for great tutorial. I have a problem indeed: i tried to add a cinemachine camera to follow my player instead of writing a code, and now my camera rotates together with my player. Is there anything i can do about it?

  • @andorazafy
    @andorazafy Год назад

    Very good Teaching bro

  • @thatonerealguy69
    @thatonerealguy69 Год назад +1

    If youre doing this in 2D and the rotation isnt working, change the LookRotation parameters to this:
    Quaternion.LookRotation(Vector3.forward, movement);

  • @k-kayla
    @k-kayla Год назад

    My input is not being recognized, both on the keyboard and the on screen joystick. I have everything set up the same. Any ideas what it could be? I am using Unity 2021.1.17f1

  • @nameless8003
    @nameless8003 9 месяцев назад +1

    Hi, my player doesnt move and i need help. theres nothing thats giving me an error in the output, im not doing the joystick just the wasd and im also using a 2d sprite in a 3d environment ive got my camera to orthogenic because im trying to make a pixel roguelike but im making it in a 3d environment like enter the gungeon but this has been giving me a headache all day please help.

  • @nathanbradley2979
    @nathanbradley2979 7 месяцев назад

    hey thank you so much for tutorial , for some reason my player is moving up and down instead of forward and backwards any way you can help thanks again

  • @spaghettoboi
    @spaghettoboi 2 месяца назад

    Great video!
    But what if I want my game to have an isometric view?

  • @dubosemeline1254
    @dubosemeline1254 11 месяцев назад

    Hello ! Does anyone know what could explain my player falling through the ground when I play the game ?

  • @muhxerovinyeva126
    @muhxerovinyeva126 10 месяцев назад

    how did you make those grids on your plane/ground?

  • @ronaldsalvador9342
    @ronaldsalvador9342 5 месяцев назад

    I added some object with collider but it the character is clipping and passing through

  • @NgXH
    @NgXH Год назад +2

    the camera will more easy if you use cinematic

  • @compergamer9200
    @compergamer9200 4 месяца назад

    hi im Brazilian Dev Junior , thank u so mutch!!!!!!!!!!!!!

  • @suyahatesntr
    @suyahatesntr Год назад +2

    I was looking for this because I want to upgrade from rpg maker to unity by making the same concept of game but without the limitation and in 3d.

    • @atomiccs
      @atomiccs  Год назад +1

      Sounds intriguing I wish you luck my friend hopefully this video helped 👍👍

  • @connorhiltgaming4746
    @connorhiltgaming4746 Год назад

    I won't let mee get the 2D Vector Binding I need help

  • @Flachyaan_yt
    @Flachyaan_yt 4 месяца назад

    I dont have the pakahe maneger tao how do i get that

  • @drake_eric9799
    @drake_eric9799 Год назад

    Don't have event system how to make it

  • @ShinChan_GS
    @ShinChan_GS Год назад

    Super

  • @jimmmybacon9043
    @jimmmybacon9043 Месяц назад

    So uh, nothing moves? idk what I did wrong, rewatched the video 5 times and found no mistakes

  • @AimedX3
    @AimedX3 11 месяцев назад

    if my game is using an isometric perspective, how can i make the player movement corrospond to the screen rather than the world?

    • @SpringDavid
      @SpringDavid 10 месяцев назад

      fixed or dynamic perspective?

  • @Santanu_Pal
    @Santanu_Pal Год назад +1

    at 9:35 it is showing "Dynamic CallbackContext" which is grayed out, and "OnMove" which is blacked.
    These two option is not present in my case.
    Even I have cress checked that if any "plublic void" function have parameter of "InputAction.CallbackContext" or any parameter, is not appearing on the list.
    Anyone can enlighten this please!!!

    • @Santanu_Pal
      @Santanu_Pal Год назад +4

      Got the solution.
      We need to click on "Player" under "Event" to add the list. By default it was not open.
      I made mistake on steps in detail. Extremely sorry.

    • @atomiccs
      @atomiccs  Год назад +1

      Glad to hear you figured it out👍

  • @mahoromatic02
    @mahoromatic02 5 месяцев назад +1

    anyone else have the problem where the controls are messed up. like everything is backwards for me

    • @sandex6811
      @sandex6811 2 месяца назад

      yea same, did you ever fix it

  • @lawrence9713
    @lawrence9713 7 месяцев назад

    Where is this thumbnail from?

  • @jkdraws5870
    @jkdraws5870 Год назад

    The option to select the onMove() function does not appear for me. I've followed all your steps up until selecting it, do you have any idea how I might fix this?

    • @atomiccs
      @atomiccs  Год назад

      It’s hard to know for sure without seeing your project but here are a couple things to check. Make sure when you declare OnMove() in the script that you made it public so it should say public void OnMove(). If that’s not the issue then at 9:29 when you drag the player object into the events area make sure that player object has the player controller script attached to it. Hope this helps! Let me know

    • @jkdraws5870
      @jkdraws5870 Год назад +2

      @@atomiccs Found the issue. Turns out it was caused by the InputManager not being saved and so it could not actually have been called by the OnMove() method in the first place.
      So for anyone having the same issue, make sure to click "Save Asset" on the Input Action screen.
      Edit: Thanks for the awesome tutorial!

    • @Santanu_Pal
      @Santanu_Pal Год назад

      If you have same problem till now please check the latest comment.
      I were having same issue but solved if myself.

  • @adweck
    @adweck 5 месяцев назад

    Hey! II'm currently at 5:18 and for some reason when I select the InputManager action, the default map doesn't change into Player (nor I can select it). Does anyone know what I potentially have messed?
    edit: 3 minutes later, I realized that I forgot to auto-save the changes in the InputManager, oops. gonna keep the comment if anyone else forgets to do that somehow I guess?

  • @deepakgautam5003
    @deepakgautam5003 Год назад +1

    Please upload more tutorial like multiplayer,2.5d,open world,gun system.

  • @nikitaeverywhere
    @nikitaeverywhere Год назад

    What is the 3D game in the very beginning of the video that goes after 2D Stardew Valley?

    • @ndna88
      @ndna88 Год назад +2

      Link's Awakening i think

    • @nikitaeverywhere
      @nikitaeverywhere Год назад

      @@ndna88 thanks a lot! 🙌

    • @KieraDharke
      @KieraDharke Год назад +2

      LInk's awakening. just another masterpiece in the legend of zelda series.

  • @mrbernaba6041
    @mrbernaba6041 Год назад +1

    how did you create the ground?

  • @bensonrong7641
    @bensonrong7641 Год назад

    It says move does not exist in current context is there something I did wrong?

    • @atomiccs
      @atomiccs  Год назад

      This means that you’re trying to access something that doesn’t exist under that name. Check to make sure your variable names are correct and that the word “move” as you used it has a variable or function associated with it. I can help better if you post a copy of your code here if that still didn’t help 👍👍👍

    • @aliengarden
      @aliengarden Год назад +1

      Switch to 'Invoke Unity Events' in the Player Input component.

  • @minima_studios
    @minima_studios Год назад

    the world space part confused me, is it neccasary?

    • @atomiccs
      @atomiccs  Год назад

      World space means it moves according to the world coordinate system, so your whole scene. If you rotated your object and moved it left for instance it would move left in the scene regardless of rotation. The other option is local/object space. In local space the rotation of the object will effect how it moves so if it’s rotated and you move it left again it will move according to the objects left. So from the object’s pov. Hopefully this made sense!

    • @minima_studios
      @minima_studios Год назад +1

      @@atomiccs yeah so i deleted world space and after a few minutes i went. ohhhhh yeah this isnt right. XD Thanks for telling me WHY it needs to be there! Great video too much appreciated !

    • @atomiccs
      @atomiccs  Год назад

      @DeepChromaStudio glad you got it all figured out 😂

  • @yorchmr3603
    @yorchmr3603 2 месяца назад

    can i have the art of the thumbnail?

  • @kozmobotgames
    @kozmobotgames Год назад

    I followed this tutorial correctly and it is not working. Please help!

    • @atomiccs
      @atomiccs  Год назад

      If your problem was the original comment you posted about the input system try making sure you clicked Save Asset on the top of your input actions like done in the tutorial. If this is no longer the issue please leave a more detailed comment on what the issue in order for to properly help you

    • @kozmobotgames
      @kozmobotgames Год назад

      @@atomiccs I have tried to press the Save Asset but unfortunately, my project still does not detect the input system by the joystick on screen. I try to move the image as a canvas element and I don't get any player movement. However, when I try to use arrow keys everything is working. I haven't pressed the Generate C# class from the screen, I simply decided to use an entirely new input actions file, where I put Vector2 value for the Move, Jump and Look variables and none of these seemed to work.

    • @kozmobotgames
      @kozmobotgames Год назад

      @@atomiccs what should I do in order to get my Unity project to work with the new Input System? I need to get it to work, I was able to get the old Input System to work especially with the Joystick asset, but this system is driving me insane and I need to find a way to get it to work.

    • @k-kayla
      @k-kayla Год назад

      I have the same issue

    • @k-kayla
      @k-kayla Год назад +1

      @@kozmobotgames Hey try this video but adjust it for 3D: "How To Use The New Input System In Unity 2022"

  • @Simon-xi7lb
    @Simon-xi7lb Год назад

    yeah this doesn't work at all lol

  • @shingAMarie
    @shingAMarie 6 месяцев назад +4

    this new input system is a complete turn off. I feel like no unity is no longer a friendly engine, but has fallen into the mistake of overcomplicated things.

    • @GiadnerGSerranoCastillo
      @GiadnerGSerranoCastillo 5 месяцев назад +2

      It's not really new anymore, either way you can use the old one without issue

  • @SomeGuyNamedRoy
    @SomeGuyNamedRoy 8 месяцев назад +1

    It'd super hard for me to look at unity tutorials after the stunt they pulled. Don't want to be locked in the next time they want to steal everyone's money for using their engine.

  • @GeoCig
    @GeoCig 10 месяцев назад

    Down vote for click bait image.

  • @jaybee9716
    @jaybee9716 Год назад +1

    When I type "UnityEngine.Input" I get "Action" instead of "System".
    Then, in OnMove(Input...) I get "System" instead of "Action". Also, CallbackContext wont come up when I type ..
    Readvalue wont come up either. Translate either. Nothing works. I've installed everything, rebooted, nothing.

  • @jaybee9716
    @jaybee9716 Год назад +1

    Spent hours trying to figure out how to make VS work with C#. Fuck it. I've been around computers all my life but for the life of me, I just can't make it work. This is stupid.

    • @bmuraaz6024
      @bmuraaz6024 Год назад +1

      It could just be the version of Unity you're using, if it's old or the input system you are using hasn't been updated to the latest version, that could be your problem as Unity tends to make a lot of mistakes when it comes to setting up Input.

    • @andrewlarking7492
      @andrewlarking7492 Год назад

      Fantastic tutorial. I have no collisions though. Would you consider extending this tutorial to add collisions and have the character follow the terrain?