Unreal 5 Tutor: Essential Blueprints 02: Player Controller
ฝัง
- เผยแพร่เมื่อ 25 ส.ค. 2024
- This video discusses the Player Controller blueprint that is used in the Unreal Engine to mediate player input, and forward instructions to whatever the player is currently controlling. It goes on to show how the developer can replace the standard Player Controller with one of their own devising, and uses a quick example that allows the player to switch which character they are controlling.
It is part of a short playlist designed to give an introduction to blueprint classes that every Unreal Engine project uses, and which the developer can make their own versions of, giving a lot of control: • Unreal 5 Tutor: Essent...
This playlist is part of a suite of videos designed to give entry-level teaching for Unreal Engine V. There are many videos on TH-cam about how to achieve specific things in Unreal, and the vast majority focus on a set of steps to achieve a specific aim, without really helping you understand what you are doing and why. My videos focus more on understanding what you are doing, so you can become a practitioner, not a copier. I have quite a few years experience of teaching Unreal in person with students, so think I have a good grasp on what needs explaining, and what can be confusing.
I am happy to try to answer questions in the comments, but won't go so far as to engage with your actual projects to help you debug. Sorry. That's a service I only provide to my students.
This channel contains videos on several subjects related to game development (some quite peripherally). These videos have been made for teaching at Northumbria University, but has been made publicly available. www.northumbri...
Wish you could've added a tutorial on how to improve the third person template by refactoring the player controller functionality into its own blueprint
th-cam.com/video/FVmpg_TJ_o0/w-d-xo.html here it is
God that intro killed me
That intro was so clean.
Thanks :)
superb tutorial on possessing different players
I'm watching these again 4 months later... Understanding it much better. In this video I'm still unsure of what else should go in the player controller. How do you fix the "lazy" construction in the template? Thanks again Dan.
Been asked this a few times now so... th-cam.com/video/FVmpg_TJ_o0/w-d-xo.html
Thanks. This is one of the most confusing things for me. I used a template that has a controller and it completely takes control of my project when I use it, bypassing all of my directly implemented controls on my character. This helps me understand a little bit. So I guess I need to move all my controls into that one controller.
There are always many different ways to do the same things in Unreal. You probably can create an effectively empty controller and keep your controls in your character that way. The intention from Epic, though, is that you are encouraged to use Player Controllers to control Characters (and other pawns). It's an added level of complexity, but it does give some great versatility. For example, in multiplayer, you can swap in an AI controller if a player's internet drops, and it makes multiplayer easier in the first place. If you had a racing game for example, your car would be your pawn, and you can have a player controller that can possess any car in the game.
Ah, so it's that kind of thing, an abstraction. Actually pretty well explained, thanks.
A nice, thorough explanation. Please keep it up!
Great stuff, though it definitely would've been preferably if you hadn't used the prebuilt third person character with predefined input mappings, since knowing how to create your own is absolutely essential to this topic. I'd recommend avoiding using any kind of starter assets for these tutorials since it encourages you to gloss over or emit key knowledge.
Really good point. The reason I do it like this is to help people get as quickly as possible to the stuff I'm covering. Also, they are aimed at relative novices (they are primarily used for my 1st year teaching) so it helps to maximise results.
I thoroughly agree, though, that anyone getting serious about Unreal needs to master this stuff. My own projects almost always start from empty.
thank you for the videos
thanks dan, good stuff but please lose the high pitch intro music, it grading, shocked me. FYI
I was beginning to suspect that those controls should not be in the player character blueprint. I came in here in search of some videos that would explain the essential blueprints as is seems no TH-cam creator wants to discuss them. They would rather spread bad habit coding. Thanks for these videos!
You are welcome. Epic are huge, sometimes the right hand not only doesn't know what the left is doing, but is only vaguely aware of its existence. They are moving too fast to be able to keep up with themselves, and they are a bit like the keystone cops with people falling off and having to run to keep up. Otherwise, of course, Unreal is awesome.
Could you make a video describing Cast To, Blueprint Interface, and Event dispatcher and appropriate usage.
My advice is to avoid blueprints as much as possible. It totally breaks the usual programming paradigms and simple things like passing variables between objects is just total agony.
You shouldn't need to be casting to 300 different types or firing events just to share the player's health with the thinger. Use blueprint and the Viewport etc. to set the basics up, but try to avoid after that.
This is so helpful! Thankyou
Very nice - thank you!
when you change the skeletal mesh to manny, NEVER forget to change the animation as well.
unfortunately for me, all the class options under selected modes are greyed out. so I'm not bale to replace the default playercontroller with my custom player controller. Any idea why my options are greyed out?
Are you on the default GameMode? That's the only thing I can see that greys out the options. Try making a new GameMode (inheriting from the default one) and selecting that in maps and modes. You should then be able to change the other things. I Hope.
would using two separate player controllers allow two players to get input at the same time? I'm trying to do a UE5 local multiplayer game with one player using WASD and the other using the arrow keys and they control separate actors
So what if the blueprint i want to possess when xyz happens isnt in the Level yet ? How do you Spawn blueprint instances from code and then possess them?
This is just off the top of my head, rather than trying it, but "Spawn Actor at Location" should allow you spawn an instance of any actor blueprint, and if it's a pawn type you should then be able to possess it with the player controller.
Awesome example ! Thank for the video Dan , i give you thumb up and suscribe !!🙌
hey Dan, great series thank you!
Cool tutorial! Thank you for your effort for it but I'm confusing because I have no idea that how controller recognize between 'possesed pawn' and 'will be possesed pawn'. Each of Third person characters has the same name 'BP_ThirdPersonCharacter'. Yes I'm a beginner,,,How is it work?
I'm sorry if I misunderstood your question. I think this is about instances of classes. Try this video and see if it helps: th-cam.com/video/LPpypap53lE/w-d-xo.html
I have a question but its not related to this video at all. Its a bit complicated but...
Do you know how to use a gyroscope of a ps5 controller into unreal ? in order to for example control an object....
I find no topic on this :(
Sorry, I have no clue about that.
But how to manually make it assign two player controllers you make to device 0 and 1 for gamepad 1 and 2?
I'm sorry, I cannot tell you, because it is something I don't know. Never tried to do that.
@@dansgamedevchannel6297 Its ok, it seems no one knows. I am watching a tutorial right now for local 2 player multiplayer, maybe I can find a way to reverse engineer it to achieve this.
@@srawdawg6188 I don't know if this will help you: forums.unrealengine.com/t/multiple-controllers-one-game/59132/6
If I wanted functionality where when my character dies I possess another pawn. Is that functionality supposed to be in the player controller? And if so, how do I communicate the death state with the player controller?
I don't know how strongly "supposed to" applies, but it would be a good place to put it. How you communicate with the Player Controller, depends where from. For most places you would do "GetPlayerController" then cast it to your version. If you were doing it from the player character, you would probably use "GetController" instead. I hope this helps.
@@dansgamedevchannel6297 thanks for the reply! I'm still a little lost regarding my project -- if both pawns have different control schemes, should I create two different player controllers, one for each? Or is there only supposed to only be one player controller?
@@SalamiMommie I don't think you can have more than one player controller (I could be wrong, there are many things in Unreal I don't know everything about). In Unreal 4, I would have said that if you want different control schemes, you should use different Game Modes, but you probably would still have to do some logic to differentiate controls. In 5, they have the new input system that seems designed to help with this by switching in and out different mapping contexts. It's complex but quite powerful.
In the first person and third person templates, Epic handle the controls in the pawn, but they use the new input mapping stuff, which they do kind of backwards-connecting to the player controller. If you did what I call "simple input" in the pawn, when you switched pawn, the controls *should* change as well (I have never tried this) but if you have any aspirations for multiplayer this will totally break. For example, if you have the pawn responding to W for forwards, and you have more than one player in the game, if any player presses W, all pawns will move forwards.
So, what I recommend, and what I think is intended, if you have different pawns with different control schemes. Create different input mapping contexts for the different pawns. In each pawn have appropriate movement functions. In the player controller, wire up the control events to the relevant movement functions (you will have to do a cast with the pawn anyway). Then, when you want to switch pawn, as part of that process swap out which mapping context is being used. A slightly simpler version does this with one big mapping context, and in the player controller check what pawn is possessed, and call movement functions appropriately.
@@dansgamedevchannel6297 thank you so much for your help! When I'm swapping mapping contexts, should I be calling this function in the player controller or in the pawn's blueprint?
@@SalamiMommie I would do it in the player controller.
There is some concept I am missing as simple as you made this haha. Would I be able to implement this if Im using a different Character blueprint then the original one Im currently possessing??
Yes you should be able to. If you put the character in the world and look for auto-possess in the details you should be able to set it up so that your controller controls that character. There may be some work to get the player controller to talk to the player character. One thing I have never done is create a rigged and animated character from scratch (one day I will brave it) but the other day I created a simple pawn that only has a camera, and got my controller to possess it like this.
I figured it out. I set up some variables in the blueprints that allow it to happen and have it running on an event tick in the character. Ill set it up to an input button so its not continuously firing.@@dansgamedevchannel6297, Do you have a discord channel up and running?