Sir, I want to thank you so much for this tutorial, personally this fixed me a lot of problems I had with my Inputs. Great tutorial, great explanation, Thanks!
@SAAVYentertainment4 ай бұрын
Thank you so much is very straight to the point (y) I'ive been looking to how to map one key (E) to a screen button, its very simple but there is no documentation or something about it Thank you
@bigofbig4884 Жыл бұрын
Thanks for tutorial, that was really Meat On Bone♥ . Hope You The Best.
@biki_02 Жыл бұрын
Bro.you are amazing.Very well explained.thank you.
@LlamAcademy Жыл бұрын
🙏 Thank you!
@benseekings25522 жыл бұрын
Thanks for the tutorial! I'm planning on swapping my mobile controls to the input system and this is just what I need. Would be good for a future video to integrate mobile controller support as well - perhaps with a basic menu to switch between both? Anyway keep up the good work.
@LlamAcademy2 жыл бұрын
Thanks! I hadn’t thought about that even though I have that implemented in my game 😅. I will add that to the list
@ChubachubaDH11 ай бұрын
For some reason, there doesn't seem to be a definition for RectTransform in the floating joystick script
@TheDurpaDurpa Жыл бұрын
Thank you for this! just subscribed. This is almost exactly what i was looking for. One question though, i would like the exact same touch and move functionality but without the joystick being visible. Would it be possible to simply remove everything related to the joystick and having the player move in the same way no matter where i press on the screen? if not then maybe i could simply hide it in the inspector? i am building a hyper casual game. Now i have to binge watch all your content during the weekend 😂
@LlamAcademy Жыл бұрын
What you’re describing might be kind of weird controls, but yes, you could just not render the joystick (don’t have to set the objects active) and you should be able to get it working
@TheMaykson Жыл бұрын
Thank you for this!
@Stinger-rq4gy Жыл бұрын
Thank you so much
@runrajrun2 жыл бұрын
Thanks dude! This helped a ton! :D
@LlamAcademy2 жыл бұрын
Awesome 😎! Happy to hear
@programmer2AGАй бұрын
everything is working fine in my case but the player speed is too much for some reason I am not sure what is going on
@1onGoogle5 ай бұрын
Hi, I've created a Third person shooter game. The problem is that it has both input system (new & old). I'm also using fixed joystick. But when I build it for android and run it from my mobile device the joysticks collides with the touch screen and not working separately. Any solution?
@inkofthedragon2 жыл бұрын
Can you please do a quick rapid fire compliation of just "who me?" clips! 🤣 Thanks in advance!
@LlamAcademy2 жыл бұрын
😁 that might be a fun end of year video!
@ozzie7034 Жыл бұрын
Thank you!
@LlamAcademy Жыл бұрын
You’re welcome 🙌!
@PetersExcapades7 ай бұрын
this is amazing thank you! but im having some trouble, how can i detect if the touch is in a UI element?
@LlamAcademy7 ай бұрын
You can use the UI Raycast to find the specific elements docs.unity3d.com/2018.3/Documentation/ScriptReference/UI.GraphicRaycaster.Raycast.html
@justfine98095 ай бұрын
Hello, Wonderful Tutorial. I need help. These 3 lines giving me an error. ETouch.Touch.onFingerDown += Touch_onFingerDown; ETouch.Touch.onFingerUp += Touch_onFingerUp; ETouch.Touch.onFingerMove += Touch_onFingerMove; error:CS103 on the "Touch_onFingerDown/Up/Move" the name does not exist in the current context.
@LlamAcademy5 ай бұрын
You have to create those methods in the PlayerTouchMovement.cs class. You can see them at 07:11
@Ashkan-yf8eu Жыл бұрын
Thank you!❤
@Tocha_official14 күн бұрын
Thanks for the tutorial. But this doesn't work in Unity 2022. I've also cloned your Github and the sample scene doesn't work. The joystick never got triggered. It won't even show when I tap.
@LlamAcademy9 күн бұрын
Thanks for mentioning this! I cloned it fresh with 2022 LTS and see the same issue. It seems in 2022 simply doing EnhancedTouch.Enable() is not sufficient to enable touch simulation. There's a script you can attach to the Player Game Object called "Touch Simulation" that comes with the new input system package that properly enables the touch simulation. I've pushed an update to the repo so it should work out of the box on post-2021 versions. I ran into this problem in another project but didn't come back to update this one. Thanks again!
@cgutierr-zgz9 ай бұрын
Is there a way for "blocking" this joystick with UI elements on a canvas for example Buttons? I would expect to be a easy way of prioritizing a canvas click over another if theres a ui element already there like a button/slider... etc :D
@LlamAcademy9 ай бұрын
Yes, you can use something like EventSystem.current.IsOverGameObject or check the selected game object to see if it’s a button or slider
@monkeymonkey696965 ай бұрын
"Hey chris here from mom academy " youtube Subtitle (Nice Video btw ;))
@LlamAcademy5 ай бұрын
🤣 here to help you make your motherhood dream become a reality
@raifazhar97274 ай бұрын
Sir, I want to know know how can we fix the joystick to bottom left side of the screen. I tried to get the position of reactransform and then used RectTransformUtility.ScreenPointToLocalPointInRectangle but it did not work.
@LlamAcademy4 ай бұрын
If you want it to be fixed to bottom left you can just anchor it there on the Canvas and not move it around at all
@raifazhar97274 ай бұрын
@@LlamAcademy but how to see if the user touch at the joystick because now we are not comparing with screenwidth/2f
@mrcyruscrap Жыл бұрын
Hi! Great tutorial! I was even able to figure out how to scale the joystick to fit different screen sizes. I have one question. My project is for PC and for android at the same time. I have input actions and control schemes: a joystick and a keyboard with a mouse. How do I make the interactions with the joystick bind to these input actions? Perhaps I need to somehow turn off the "keyboard with mouse" control scheme when I use this joystick?
@LlamAcademy Жыл бұрын
I’m not totally sure 🤔 I think you are right about the enabling/disabling input action maps but back when I implemented my mobile + pc game I was using the old input system and just had different scripts that enabled / disabled themselves based on the platform
@kastinante6883 Жыл бұрын
thanks , for a Beginner,actually useful,subscribe and like!🔥
@XadegamerOfficial2 жыл бұрын
I would like to see camera for a third person mobile controller. Thanks for the helpful tutorials
@LlamAcademy2 жыл бұрын
Sure! I had some future topics planned for the camera handling such as what you saw on the Llama Survival clips here!
@XadegamerOfficial Жыл бұрын
@@LlamAcademy being trying to use this technique to make a camera control for third person controller but not getting a good result like Oceanhorn, COD mobile or even Apex mobile. If you can make a tutorial to cover any of this, I will really appreciate it.
@ShironatsuKun Жыл бұрын
Is there a way to make this work on UI Scale Mode of "Scale With Screen Size" properly so when you run the game on different types of mobile devices the Joystick UI will automatically scale for different mobile phone resolutions? Or is there a different way to do this easily? I tried setting the UI Scale Mode to "Scale With Screen Size" so the joystick will automatically scale based on the device's resolution but the joystick just pops up with a weird distance from the point of Touch and the Clamping is also different so I just want to ask. Thank you.
@LlamAcademy Жыл бұрын
Yeah, you can have it scale with screen size but you may need to consider the Canvas's scale to scale up the maxMovementDistance relative to the designed size of the Canvas
@fortnoc3216 ай бұрын
Hey did you figure out how to do this? Struggling to get it to work with "Scale with Screen Size"
@sumnererhard8865 Жыл бұрын
Excellent video! Curious if this joystick will work in a scene with UI elements built with UI toolkit? For example if you had a pause button on the top left of your screen that was using the UI toolkit, how would you handle distinguishing between a Joystick input vs pressing the pause button?
@wahebplays Жыл бұрын
what about touchzone for camera Look (cinemachine &new input system)
@mecadiego113 Жыл бұрын
Amazing video and thank you for the tutorial! Any advice on how can I implement the joystick aiming (rotation) you tease at the end of the video. I'm having issues with that, because when I rotate the player's rigidbody, the movement (using the movement joystick) doesn't follow the forward direction
@LlamAcademy Жыл бұрын
I’m using the same concept there, just applying the force based on the current velocity and the current forward of the player. The transform has localRotation and forward properties. You can use to apply force based on these values to smoothly accelerate and decelerate
@Ironlionm4n Жыл бұрын
At 5:25 how did you determine the joystick size? When I looked back in the video your joystick had a width and height of 200 so not sure where 300 came from here.
@LlamAcademy Жыл бұрын
I was just making up a default value of 300x300 on the JoystickSize on PlayerTouchMovement so we have some size by default. You can adjust this in the Unity Inspector if it's too big/small for your game. I just played around with values until I found reasonable looking ones for my case.
@OliMakesGames Жыл бұрын
Great tutorial! Just one thing - when I add a button to the area where the joystick is active, the joystick still jumps to that position - even though I just want to press the button. I even tried to add an event trigger to the button (pointer down) to disable the function, but it seems the Enhaned Touch gets called first so it still jumps to that position! Is there a way to "layer" the joystick so it does not jump to the button presses or is "below" the button?
@LlamAcademy Жыл бұрын
First, I would consider if you really want to have very many buttons on the half of the screen with the joystick. Most of the time (in my opinion) that results in it being harder to play the game. If you really need them, you have a few options. Probably the easiest one is if you do a GraphicsRaycaster.Raycast from onFingerDown and see if you've touched one of your buttons. If you did, just disregard the event. If not, then proceed with the logic here.
@MarekNijaki2 жыл бұрын
Awesome tut! Could you make follow up with handling touches for camera itself. Eg like in Fallout Shelter game(base management mode), where you can pan camera, zoom in and out, smooth it movement, move based on swipe speed etc?
@LlamAcademy2 жыл бұрын
Sure, I had some future topics planned for the camera handling, so I'll add this as one of the options to look at in the future! Thanks for the idea
@alonsojetski Жыл бұрын
The navmesh agent component does not appear when I click add new component :(
@LlamAcademy Жыл бұрын
You may need to add the Navigation package from the package manager on very new versions of Unity
@ReaperMZM2 ай бұрын
Hey man can u give me some tips for how to make it for a fixed joystick
@LlamAcademy2 ай бұрын
For fixed joystick you just don’t move the joystick around and only consider it a “successful placement” when the finger touches within the bounds of the joystick position.
@ReaperMZM17 күн бұрын
Sorry for the late reply thanks man
@abuzzakasm97672 жыл бұрын
nice tutorial ..im using unity new input system .. for free look rotating camera we use delta mouse position but what will i do if i want to do the same thing for mobile ? if i use gamepad left stick it keeps rotating unless i put my finger off .. i could not find any delta stick for reading the change of value . .Can you cover this topic?
@LlamAcademy2 жыл бұрын
Sorry I don't think I understand the question. In this video I show how to use the delta position of the touch to drag the "knob" on the joystick for touch input controls. If you want to rotate a camera based on the delta position, you can use the same concept as here but apply it to rotation instead of position
@hasanrakib4811 Жыл бұрын
How can i add a second joystick on the right side of the screen. so i can use the left side joystick to move and the right side joystick to aim, like a twin stick shooter ?
@LlamAcademy Жыл бұрын
The way I implemented this was to track if the initial contact point was on the left or right half of the screen ( < or >= Screen.width ). Then handle each touch like we did in this video and just apply the input to the player object!
@kolithehapty48835 ай бұрын
what if I don't want it to just be able to be touched on the left side?
@LlamAcademy5 ай бұрын
Then just don't check that condition 🙂
@lucasradioativo Жыл бұрын
how to add other buttons?
@duck7303 ай бұрын
When I select source image I have no option for circle-border-06 Anyone know how I can get it?
@LlamAcademy3 ай бұрын
It's included in this video's project files on github
@arnabmondal30322 жыл бұрын
hey mate I was wondering if there was a way to connect the input from this joystick to a inputActionAsset and use the input from the inputactionasset to move the player
@LlamAcademy2 жыл бұрын
That might be possible. I thought that felt kind of backwards since you need to address the movement of the joystick handle anyway. I handle multiple input controls where touch option is handled like this and the keyboard / game pad is handled by those input actions
@tinyboy64582 жыл бұрын
Plz do a video about brust compiler ❤️
@LlamAcademy2 жыл бұрын
I haven’t used it yet, but I do have a use case for it so I’ll make it once I have enough understanding to teach about it
@tinyboy64582 жыл бұрын
@@LlamAcademy ok 😀
@maxg51962 жыл бұрын
So how would you allow a finger to press multiple buttons at the same time by sliding over them? The implementation is I am trying to make a mobile joystick for movement on mobile, but there is also a run button above it, and if you slide your finger high enough while also dragging on the move joystick it will engage the running. Please help!
@LlamAcademy2 жыл бұрын
For that one, I think I would try to make it by checking if the current touch position relative to the initial position delta was great enough that it would indicate the player had moved their finger into the "run" zone. If you really want it to be the same finger that has to initiate the "run" mechanic then you might consider making it a zone at 90% or something of the max radius. From what I've seen, usually for actions you use a second hand, no the same one that is moving the player, so I'd play with this to see if it works well or is just awkward to use.
@maxg51962 жыл бұрын
@@LlamAcademy ok thanks. Yeah I was thinking something similar.
@ghost0fherobrine2032 жыл бұрын
Well, I am doing this with a Rigidbody and on line 107: Vector3 scaledMovement = Player.speed * Time.deltaTime * new Vector3( I have an issue because speed isn't a part of Rigidbody so what should I do there?
@LlamAcademy2 жыл бұрын
Usually when using a Rigidbody for movement, your PlayerMovement script has a field defined as maximum speed such as [SerializeField] [Range(0,5)] private float MaxSpeed = 2.75f; You can then use this in place of Player.speed.
@ghost0fherobrine2032 жыл бұрын
@@LlamAcademy Thank you! :)
@Stinger-rq4gy Жыл бұрын
Dear LIam Academy, Can This script be done with the Unity Starter Assets FPS Controller with the move and look touchpad? Could you make a tutorial on this for me for Unity Starter Assets FPS Controller? I have been stuck on this problem for a looooooong time.
@LlamAcademy Жыл бұрын
Yes! You can apply the same idea here just to the CharacterController component on the player prefab from the starter assets instead. For aiming, you can use another joystick or some other input mechanism to apply rotation using the same concept here, but I think that one is a little more tricky.
@Stinger-rq4gy Жыл бұрын
@@LlamAcademy thank you very much for your help do you know of any float joystick scripts online that I could use and then after that once I've made the script to why you just drag it on to the move and look as a child in the hierarchy?
@LlamAcademy Жыл бұрын
@@Stinger-rq4gy sorry, didn't understand your question. You can use the same concept for the floating joystick as we implemented here. It's just mapping the values to something else
@Stinger-rq4gy Жыл бұрын
@@LlamAcademy so I went to the unity standard assets website and I downloaded the unity starter assets pack which has a FPS controller. so when I download my unity game to my phone the look pad which makes you look around on the right side of the screen stays fixed in place. When you play games like Call of Duty mobile the look pad on the right is a floating joystick it doesn't stay fixed in place like it does but the unity starter assets FPS controller look pad. I just want to mke the lookpad on the right hand side of the screen a floating joystick. If you help me to do this in Unity on Discord I'll make you props for your game, and build some things for you, and share any assets I find on the asset store that are really good.
@ZeeshanKhan-ny8pm11 ай бұрын
what if i dont want to use navmesh agent?
@LlamAcademy11 ай бұрын
You can do basically the same thing with transform.translate, character controller.move, or applying force to a rigidbody
@andrewallbright2 жыл бұрын
When will the new input system stop being new?
@LlamAcademy2 жыл бұрын
Maybe when a new one comes out? 😆
@stefanpavlovic3548 Жыл бұрын
03:50 But what if i really need to use "Scale With Screen Size" is there any workaround?
@LlamAcademy Жыл бұрын
Yes. You can scale it with screen size but then you have to query the Canvas Scaler for the scale factor and do some additional math around that
@fortnoc3216 ай бұрын
@stefanpavlovic3538 Hey did you figure out how to do this? I'm struggling to find any information on it atm.
@stefanpavlovic35486 ай бұрын
@@fortnoc321 I don't remember if i ever solved this.I abandoned that project shortly after that comment was written,now im working in godot
@fortnoc3216 ай бұрын
@@stefanpavlovic3548 Np thanks for the reply! It was a simple fix for me, I had a safe area helper shifting my UI objects for me and it was screwing up the scaling math.
@aytekinmuratatasever10 ай бұрын
@chiragsawajiyani85402 жыл бұрын
Hi sir , I have a question like How to assign a unity event to a button.Onclick.addlisner() event. Like i have a button refrence in a script and instead of assign methode call in onclick event of that button i have a unity event in the same script which have that button refrence and invoke this event by using button.onclick.add listen (). Thanks
@LlamAcademy2 жыл бұрын
Hi! Unity has documentation on how to do that with a bunch of options here: docs.unity3d.com/2019.1/Documentation/ScriptReference/UI.Button-onClick.html