Unreal Engine interaction - Overlap with the pawn tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so now we can start hooking this up to uh some new kind of uh yeah two more game melodic so I'm just gonna I'm gonna go I switched over from the simulate mode over to the new editor Window mode here I'm gonna do a select the viewport here so now you can see that I'm running around with a default character here and I'm bouncing into these uh into this uh the ball here so I'm gonna extend the uh the kind of the player to uh to call the bouncing ball so basically whenever the the pawn overlaps uh we're gonna we're gonna go in and uh and bounce the ball so uh let's just take a quick look on how that is done uh we're gonna find the the blueprint for the third person character I like to do it from this menu here uh we go to the third person character uh there's a bunch of logic here that we're not gonna worry about but uh we'll go to the viewport here I'm gonna add a new sphere here a sphere collision and you can see that it's here very small I'm gonna make it a little bit bigger so it goes around the character and here on the right I'm gonna say overlap bolt Dynamics and then I'm gonna go here and I'm going to find an event here on the uh I'm going to call my sphere ball bouncing over lap sphere here we go and then here now that I have this video selected I'm going to go and I'm going to see on overlap up on begin overlap on component begin overlap so on the character now I'm getting an event whenever it overlaps something so you can see that I had the other actor I have a component and a bunch of other information uh I am also going to just so that we can see it I'm gonna turn on debug drawing I see is that not possible uh all right I thought that was going to be possible but uh doesn't matter all right so at least we just know that our Pawn now has this circle around it and whenever anything that has the correct Collision kind of settings overlaps it uh we're gonna so it's gonna be the correct Collision press is going to be it is the answer to the overlap all Dynamic uh kind of thing here uh we're gonna get an event so let's just start by adding a print here so now I'm inside of the third person character and anytime that I overlap something I'm gonna print the name of the actor so let's go over here and go here you can see that a little bit here on the screen it's doing it's printing everything it started off actually by printing itself because it's overlapping itself so now that I get closer to this ball here you can see this is the first ball uh so we're getting the event uh went through and basically what this is doing the third person character now has a reference here on another actor so we know that another actor is uh is kind of that we're overlapping it so what we want to do is here on our bouncing ball we want to go and we want to say do the jump because we're overlapping the uh we're overlapping the ball and we want to tell the ball to do the jump so we drag out here the other actor and we do say do the jump and nothing happens and this is because and this is really important to understand that the other actor if you hover over it this is an actor object reference while our bouncing ball is a BP bouncing ball actor reference and when we did the uh the variable here at the bottom right bottom left you can see that we made a variable type of the bouncing ball type uh and you can see here at the top right corner that our parent class is actually actor and this means that our blueprint and almost all blueprints most blueprints are kind of inherited from actor so all we have to do here is we have to say okay so we overlapped something but we don't know what it is well we know it's an actor but we don't care about the character we don't care about anything else so what we can do is we can drag out of this and we can do a cast a cast to BP bouncing ball and what this means is that it takes in whatever we overlapped uh it says all right so I know that you're an actor but the cast is gonna check are you an actor and are you actually a bouncing ball because if you are great we can go ahead and we can do things uh we can do things there but if you're not uh then I just don't care I'm just gonna ignore that so uh in this case we're gonna go go ahead and we can say we're going to do the cast and now the cast it actually outputs the bouncing ball type for us so you have to type and on the bouncing ball type we can do do the jump all right and now when we press play whenever I move you can see that anytime that I go in range of a bouncing ball here it's going to jump pretty cool so now we can run around here and now we have a little bit of logic where uh anytime that the character goes close to the uh goes close to the actor uh the bouncing ball it's gonna bounce so this was an example showing off how you can how you can use the physics system or how you can use the overlap system itself to get a reference to the reference to an actor normally when you do these kind of overlaps and things like that you're not going to get the specific actor that you want so you have to do a bit of filtering and in this case we're doing filtering with the cast we say I don't care about any of the other actors I just care about it if we overlap the bouncing ball and then if we if we do overlap the bouncing ball we actually do the we call the function on it here
Info
Channel: Gisli's game development channel
Views: 8,486
Rating: undefined out of 5
Keywords:
Id: _4Atjp2D-ik
Channel Id: undefined
Length: 6min 13sec (373 seconds)
Published: Wed Mar 08 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.