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... Хобби
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
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);
}
@@atomiccs thanks!
I did if(move.x == 0f && move.y == 0f) return; first line of MovePlayer method, works... make not the best way
@@maiconsantana6995 if(move.Equals(Vector3.zero)) ;)
@@atomiccs dawg you are a LIFESAVER omg
Painfully underrated tutorial
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!
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.
Helped me a bunch, amazing tutorial
Hope you keep it going
Brooo you made in 16 minutes what it took me 6 months to learn... Totally underated tutorial. ❤❤❤❤ Gettings from Perú
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;
Never thought a lightmode-user would make something so helpful.
This tutorial is fantastic, you deserve more subscribers
thank you so much! been trying to get this right for hours
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 😁😁
Another great way to do it!👍
Simply awesome my man, thanks!!!!
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.
Awesome so glad to hear how it helped you out!
@@atomiccs I’m currently trying to figure out how to make my bullets bounce on walls on my 3D game…
All of the unpopular channels are sometimes gold
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 :)
Awesome addition thank you!
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?
Great Video! thanks a lot!
I think this is the first time in years i see someone writing codes in light mode.
Great Video
many thanks -works like a charm
for me, I didn't use the entire tutorial, just bits I needed to make my movement work; @@piotrmontgomerytv7786
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?
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?
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?
Very good Teaching bro
If youre doing this in 2D and the rotation isnt working, change the LookRotation parameters to this:
Quaternion.LookRotation(Vector3.forward, movement);
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
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.
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
Great video!
But what if I want my game to have an isometric view?
Hello ! Does anyone know what could explain my player falling through the ground when I play the game ?
how did you make those grids on your plane/ground?
I added some object with collider but it the character is clipping and passing through
the camera will more easy if you use cinematic
hi im Brazilian Dev Junior , thank u so mutch!!!!!!!!!!!!!
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.
Sounds intriguing I wish you luck my friend hopefully this video helped 👍👍
I won't let mee get the 2D Vector Binding I need help
I dont have the pakahe maneger tao how do i get that
Don't have event system how to make it
Super
So uh, nothing moves? idk what I did wrong, rewatched the video 5 times and found no mistakes
if my game is using an isometric perspective, how can i make the player movement corrospond to the screen rather than the world?
fixed or dynamic perspective?
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!!!
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.
Glad to hear you figured it out👍
anyone else have the problem where the controls are messed up. like everything is backwards for me
yea same, did you ever fix it
Where is this thumbnail from?
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?
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
@@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!
If you have same problem till now please check the latest comment.
I were having same issue but solved if myself.
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?
Days you just helped me thx
Please upload more tutorial like multiplayer,2.5d,open world,gun system.
What is the 3D game in the very beginning of the video that goes after 2D Stardew Valley?
Link's Awakening i think
@@ndna88 thanks a lot! 🙌
LInk's awakening. just another masterpiece in the legend of zelda series.
how did you create the ground?
Its just a big cube with a texture
It says move does not exist in current context is there something I did wrong?
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 👍👍👍
Switch to 'Invoke Unity Events' in the Player Input component.
the world space part confused me, is it neccasary?
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!
@@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 !
@DeepChromaStudio glad you got it all figured out 😂
can i have the art of the thumbnail?
I followed this tutorial correctly and it is not working. Please help!
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
@@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.
@@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.
I have the same issue
@@kozmobotgames Hey try this video but adjust it for 3D: "How To Use The New Input System In Unity 2022"
yeah this doesn't work at all lol
lol nvm
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.
It's not really new anymore, either way you can use the old one without issue
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.
Down vote for click bait image.
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.
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.
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.
Fantastic tutorial. I have no collisions though. Would you consider extending this tutorial to add collisions and have the character follow the terrain?