How to Make the Point & Click Mechanic to Move Your Player in Unreal Engine 5

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's up guys welcome to new Unreal Engine 5 tutorial today concerning how to create a point and click mechanic so your player will go into a specific point that you have pressed with your mouse on your camera it's gonna be a very easy to follow so let's get started alright so the first thing I want to do is right click go and create a new blueprint class this will be in the character and this will a BP underscore for example player let's open this up so the first thing I'm going to do is go into the event graph and I'm going to delete all of this I'm going to say that when we press the left Mouse button we'll go ahead and do something in this case it's the key that we want to use to select the point that we want in our level from a camera and go there okay so we'll see how we go so we're going to do is basically do a line Trace by Channel a line Trace is basically an invisible broadcast like a line which will go from A to B and it will detect whatever it has hit so in this case we will get the location of that raycast so we'll go from our camera to where the mouse is pointed so then we can get a location so in this case let's this is now which is this the get party controller because it will get will get access to this other note which is basically convert Mouse location to World space this is very important because this will allow us to begin in here so where our Mouse right now is and now we can get the direction of that and just basically multiply it by a float so just right click and convert this into a flow single Precision now this is the distance that we want to be able to click in this case let's put a very high distance like 10 000 just to make sure that we will get what we want and now let's get it wall location and add it with this vector and that will give us our end point and you will see that if I put this in for duration it will work but first of all let's add a few things in our mesh in this case I'm using the third person template so I can use find for example many and you spliter here with what I'm going to do so minus 89 this is a good in location and then let me go ahead and add a camera boom so camera boom boom in this case will be a arm length arm length spring army they changed the name every two weeks okay so I had to make use of it so now the spring arm will allow us to place a camera and you can see that it will be placed in the end up here so we'll be aiming here so now the spring arm can just rotate it put it up increase the size into like a thousand and 200 for example it'll be very far away and our camera will be here so now if we press play as you can see we're using all our players so let's let me change to use the other player so in both settings game mode let's put our player to be our default Pawn classic now so you can see we have this here you can see when I click you can see that I'm getting the right cast so it's basically doing some rays and to the point great so another thing to do is in the begin play so let me do a gameplay is just go and Scout again the get a game player controller and then set show mouse cursor and this will just lost to see the mouse every time and it will not be hitting as you can see down we can see where we are clicking and pointing great so with that said let's make our Player move into that location that we're hitting in this case let's first of all make sure that we have hit something just in case and now if we get this and break we have we talked we have all the information of that specific point that we have hidden and now what we can do is go and get this and use this note which is uh move two and we can see that we have the words aggressive location um simple move to location okay now the test one it will be the navigation one simple move to location and here the control because we get controller so ourselves and the goal will be the location we have to add one thing into our level to be able to let our player navigate and it's gonna be in here so quickly add to the product let's go into uh voice volumes and go into nav mesh balance volume so new booking is adding to the scene let me click this reset button so be like in the zero the scene and again just say scale and put like 20 it will fill in the whole scene let me smoke it a bit so actually fill in the whole scene like this then press B and you can see now we can Now preview all these paths that our AI now can go and now you'll see that when we press play and point the player will go into that specific location now the thing is that let's make it so that it will look into where it's going so it can go into the character movement component go a bit down and enable Orient rotation to movement and now you will see that the player will go ahead and well okay so yeah so you've seen that we have no problem except the AI is trying not the AI the player is trying to always be facing where our camera is so first of all let's go into class default search for yo and disable use control yo you'll see the now that will change how it looks but I can see the player is like rotating the whole camera and so on we don't want that so let's quickly go into spring arm and click on where's it use spawn control rotation and now you'll see that the camera will be still but our our player will Orient what is looking but now this introducing new problems that the camera now is like the rotation has been let's say that over again right like the rotation is not doing anything more so now what we need to instead is go and put like a thousand in the socket officer and then get the camera and rotate it maybe like 30 degrees down and now we are looking down and we can press and the player will go there so let's quickly just go ahead and apply some MLB animation so let me just right click animation go into Legacy Blank Space 1D SK mannequin and we can select that this will basically just allow us to transition between different animations depending on the speed so again here you split speed maximum will be uh 500 600 I think in this in our player snap to grid so now I can search for the auto animation and for the idle in the left so when there's no speed and then go and put the run or whatever you want in the right so when there's speed so as you can see if I hold Ctrl move around along this timeline the speed will increase and the animation will increase with it right so now we need to create an animation blueprint to apply all this Behavior so let's let bsk mannequin once again ABP underscore player open this up and get our blend space which in this case is called like this very cool name new place and I just right click promote this to a variable so now the speed will be set if I were to put a hundred it will slowly move so you can see but let's make sure that the default is zero now the bank graph let's just get the velocity from the owner of this blueprint because we want to change the speed depending on the one of the player in the game so we can just get the one from the owner and just pass in there which is this node which is the vector length so we'll convert the vector into float and now yes we can pass into the speed we need to of course remember to apply here so I will be ABP player and now yes you can see when I press play I can go to this point as you can see before we'll go and everything is works and I can interrupt that point there so that's it guys if you found this so helpful I really appreciate your video and subscribe to my channel lots of unbrew engine fat Terror so make sure to check them out the profiles will be available in my patreon and YouTube members join my Discord server follow me on Instagram juice and now yes with all that said I'm fine [Music]
Info
Channel: Gorka Games
Views: 22,972
Rating: undefined out of 5
Keywords: games, videojuegos, unreal engine, unreal engine 5, ue5 point and click, tutorial, quixel, megascans, unreal engine make point and click tutorial ue5, ue5 point and click player move tutorial, ue5 player move to camera location tutorial, how to make point & click in unreal, unreal engine 5 how to move character where mouse cursor click, point and click mechanic, point & click tutorial in ue5, ue5.2 point and click
Id: o4K4tfWQL7g
Channel Id: undefined
Length: 8min 5sec (485 seconds)
Published: Mon Jul 03 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.