How to Make a Pet Companion AI in Unreal Engine 5

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
what's up guys welcome to new engine factorial today again show you how to make an AI Pet Companion it's gonna be a very easy build to follow so let's get started alright so the first thing that we will need is of course our AI pad companion model itself in my case I have imported this free pack from the marketplace I will leave in the description in case you want to grab the same one as me but basically it has different animals that we can use with our pet of course you can use whatever model you want we're going to be using one of those um so let's go ahead and start creating the blueprint itself so just right click in the content browser go into blueprint class and then go and select character it will already have the character movement component the skeleton mesh add into it the capsule component everything in setup let's go ahead and name this BP underscore is Pet Companion or whatever you want to call this and let's open this up in this case we'll be making a simple AI so we will just do it from blueprints nothing crazy from behavioral trees if you want to see some of my tutorials on me here with trees um go ahead and check them out um so in the mesh we can now go into the skeleton mesh acid and of course find our pet in this case we have a lot of different options in my case let me just go into the fox so it is actually quite small which is good because normally pets are smaller than you kind of of course you can have massive pets if you want we can just play around with the values so I want to do is basically place it pretty much at the bottom of it and basically just drag into the scene and you'll see a bit how much is happening on the ground as you can see we need to put it into the tip so basically you just put it on more down and then put into five maybe and put a bit up um maybe into one put a bit down I think that's perfect let's see yeah that will work for me okay it's pretty much in the ground of course you can play out with the um settings in my case you can copy Max stack the same position known here great so we have the character there so now let's go into the bank graph and delete everything except to begin play Let's go ahead and create a new custom event which will be basically follow the layer okay with that what we can do is call this node which is the AI move to and we can just go ahead and put self into town because that's the AI that we want to move and then the entire actor we can now simple I just go ahead and just say get player character and with that we can put acceptance radius this is um basically how close it will get to the player for pets I recommend setting this to around maybe 150 something like that because if it's too close it will annoy the players so we want to kind of keep it a bit of a distance but close to it you know and then on success we're going to do is just color again uh Power Player so it will be in a loop and of course we have to call it once to initialize it so on the gameplay will do so and that basically will just make our AI follow the player one once and once again and forever basically okay and with that said what we can do is just go into the scene and now you will see that when I press play nothing will happen the thing is that a new engine needs something to be able to calculate all the pads that the AI can go so let's go up here and let's go into the volumes and you'll see this nap mesh bounce volume basically we have to go into the skill and put this to be of example 20 so it will fill up the whole scene now if I press P you can see everything inside that box will be calculated so now the area can move very very important so now we press play so you can see the AI will indeed going forward though some things happen the thing is that his rotation and movement are very Snappy and doesn't really look too good and of course then we have to add the animations so what we're going to do we'll quickly just go here into the AI companion blueprint let's go into class defaults and search for yo we're going to go ahead and disable this because this will really be setting the rotation to be very Snappy and we want to do it in another way we want to just go into the character moving component go down until we see the Orient rotation to movement and enable this and with that you will see that the rotation is way smoother now we want to add the animations in Twitter so we're going to do is search my animations in the pet but first of all let's create what we need which is just go ahead and right click go into animation and then in Legacy you will see this plan space 1D we're gonna go ahead and select the fox skeleton and then we just want to put a you know pet and plant space or whatever let's open this up let's go into the horizontal axis and put here the speed and then we'll go ahead and put the maximum axis value as the max speed also by the other hand I want to also select the character mode component go into the max speed and basically go ahead and um decrease it so let's put for example 450 so it's a bit slower and then we're gonna go ahead and put and what was it 450. yeah so 450 in here which is his max speed so now in here we can do is search for idle or whatever and then we can support for example uh aggress and look around maybe just like looking around and then we can just put the Run Mary test here run and just get it run and put it here so now basically as if we hold Ctrl move across the timeline as the value of the speed increases it will be transitioning from the auto animation into the Run animation so great now what we'll have to do is just create the animation blueprint the last thing that we have to do so just right click go into animation blueprint select our Fox custom create ABP underscore pet let's go ahead and open this up now all we need to do is search our um blank space so plant space 1D is rugged and then just plug it in the result yes we now have to set the speed and if we are where to put this at for example 450 and then compile so you can see he will be running but the things that we have to set this depending on what speed is moving in the game so just right click promote variable so as it's in a variable we're going to go into the bank graph from here we're going to get the velocity from the owner of this and blueprint and I'm going to use this node to convert this into a flow so the vector length note with that we can now go ahead and just drag the speed and set it with it's a corner speed so just getting the owner speed and then set it in there with that we just have to go into the viewport um what these do let me just go ahead and just put components sometimes I don't know real engine just like kind of crosses my components I don't know why but let's just go into the mesh name class and now search our AI pet plug it in press play as you can see now we have our AI that will follow us and with its animation and everything and of course you can change the speed the distance I will stop and so on so that's it guys it felt so helpful I will show you if you like the video and subscribe to my channel I have lots of Unreal Engine 5 tutorials so go ahead and check them out if you're my Discord servers follow me on my socials and now yes bye bye foreign [Music]
Info
Channel: Gorka Games
Views: 18,421
Rating: undefined out of 5
Keywords: games, videojuegos, unreal engine, unreal engine 5, ue5, pet ai, tutorial, quixel, megascans, unreal engine pet ai, companion artificial intelligence unreal engine 5, ue5 companion ai, ue5 ai pet tutorial, ue5 how to make a pet ai, unreal engine 5 simple companion ai, unreal engine 5 easy pet companion ai, unreal engine 5 ai follow player
Id: ALb7CmsgjUE
Channel Id: undefined
Length: 7min 18sec (438 seconds)
Published: Tue May 30 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.