RTS Camera Quickstart UE5 (Marketplace Pack)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello welcome to a quick start video for the rts camera system in unreal engine 5. if you're using unreal engine 4 then you should watch a different video in the link in the description below so this system uses the enhanced input plug-in for unreal engine 5 so we'll need to enable that before you kind of go any further so it's very very easy we're going to go settings and then plugins i'm going to go search for enhanced input you want to tick that on and then restart the editor if it prompts you to and then once you're back in unreal we're going to go settings project settings scroll down to input which is there it is and then scroll down slightly and you want this default classes section and what we're doing here is we're just telling unreal to use the enhanced input plugin and not the default system so change the default player input class to the enhanced player input and the default input component class to the enhanced input components uh if you are familiar with this plug-in or sorry this asset pack from before you may know that we used to use the asset machine the asset the action and axis mappings sorry we don't use them anymore so if you have them and you want to entirely switch over to the system you can just delete them if you were midway through a project obviously don't do that stick with the kind of you shouldn't really have downloaded this if you're a midway for a project so it should be fine um but yeah we won't need those for this so next thing we can do we can go to our rts camera so if you've not done this already go to the marketplace and merge into your project and you'll end up with this rts camera pack here so we go over to demo and we can open up this overview map and that's going to open up kind of a good demo sandbox map so we can go ahead and hit play and all the controls are going to work out the box because enhanced input works very nicely for this so we can use wsad to move around we can hold down the middle mouse wheel to do like a free tilt around we can hold down the right mouse button to do a drag style move uh we can roll the middle mouse wheel to zoom in and out we can hold q and e to do linear rotates around and we can do kind of a selection based system and this is kind of just a loose implementation of kind of a selection system so we're going to click on the selectable buildings and you can see we have an automatic camera jump system that moves you smoothly over to them it also fires off a is selected event inside the building so if you wanted to like trigger a ui to pop up at that point you could do that very easily we don't have a box selection or a marquee selection in this plugin that's not implemented um up here we've got animated object if we select this you can see the camera jumps to it it also parents to it and it affects the zoom so you don't have to affect the zoom it's there as an option if you wanted to like zoom in close to a unit when it's selected it's entirely optional and it's there if you want it um so one thing we have uh in this thing one kind of a common problem is the camera will attempt to try and go through objects by default um and it is based on the spring arm component so there is a kind of a built-in system for avoiding collisions in spring arm but i don't think it's very suitable for this so i've made a custom solution called the repulsor and essentially if your camera intersects an object it will just attempt to angle it upwards to get it out the way so if we bring our camera down here and we go ahead and just drive our camera right through this box it'll angle us up and clean the other way so we never really look inside and see all those internal normals that you know the average user shouldn't be seeing so if you see that happening that's what that is if you load into a level and your camera just shoots straight up to 90 degrees uh that means your camera is intersecting something and you may need to look into your collisions uh in your level so i'm going to bring this back down now um the camera is designed to follow the terrain so if you find there's like you know if you're doing natural terrain like slopes and things then it will naturally follow it um there's no great solution for if it falls off a cliff so if you do fall off a cliff the camera will just naturally fade back down to the ground very gently and if you're holding the controls it will carry on kind of falling very very gently because there's a lot of air control and you can tweak all of those settings they're just basically linked on the character movement component so you can tweak those as you want and i'll show you those in a second if we press p on the keyboard that's going to open up some debug prints and things uh mainly it just lets us see kind of where our origin sphere is if we move around uh the red sphere is our kind of actual actor origin and this little line here is showing the camera lag that's going on to kind of smooth out the current system and if we fall off a cliff you can see that's our trace going down to try and bring us back down to the ground i'm just going to press p to hide that we've also got some fixed rotation angles up here on the ui these are just a proof of concept to show how you could add them if you wanted them uh you definitely want to design a better ui than this one uh this system also fully supports controllers so let me go ahead and turn my game gamepad on i'm just using an xbox controller here and now if i use the right thumbstick we can move around you can see the reticle has automatically adjusted itself to a different type of control scheme and the system has also changed the mappings entirely over to the um gamepad based mapping system so it means you can have different scalings on different things if you want your right stick to move faster but you don't want it to move faster when you hold down the middle mouse wheel that's one of the really big strengths of the enhanced input component system that we can now tweak on a kind of a per platform basis those inputs and you can allow the user to tweak those as well so you could expose out a controller sensor sensitivity slider and you could separately have a mouse sensitivity slider and there'll be two separate options you can expose really really easily thanks to the enhanced input advanced input system so that's one of the main reasons we've switched it otherwise it all works much the same we can do the left and right triggers to zoom in and out uh we can move around we can mouse over these boxes and you can see cursor turns blue and we hit them with a trace i can hit the a button or the gamepad face button bomb to do the same snap system and it also has the same repulsive technology as the other one so we just angle up and down um it does also support uh touch uh however i can't demo that to you in this video so um we'll look into a way of demoing that in the future i'm gonna just press escape or shift escape to get out of the play mode now um as far as finding the assets we've got this rts camera pack and we've got our blueprints inputs resources and widgets so blueprints contains kind of the core systems rts camera here this is the actual pawn that we play this contains 99 of all the code for this project this one next to it the rts camera old input style this one uses the input mapping system that was in unreal 4. this is not currently used for any reason however it is there should you need it um just in case you want to refer back to it or whatever reason it's there and if we open up our rts camera let's push on the other screen basically we've got all the blueprint in this guy here it looks like quite a bit but it's um relatively not too bad there's kind of quite a bit of little maths and things going on um and everything's interpolated and smoothed which is why it kind of gets extra lengthy if you want to tweak the overall feel of how the character moves you want to choose the character movement component as normal so just select this guy and then especially look for the ones that have got these reset arrows because these are the ones that i've already tweaked so this gives you a good sense of which numbers you should play with beyond uh anything else but these numbers i've already tweaked the ones you might want to tweak further especially things like the air control and breaking deceleration those affect i look quite a lot of things especially when you're kind of falling off cliffs um things like the step height and the floor angle those are affecting the ability to like walk up and down buildings and meshes and we want those very high for this sort of system to make it all fluid but you can play with those as you wish if we go down to the options variable here we've got a bunch of stuff that you can turn on and off so things like the overall zoom speed multipliers minimum zoom maximum zoom um whether you want to lock them out of the viewport inverting certain things do you want edge scrolling on or off which we didn't cover but the system does have edge scrolling um you'll need to set up the hud for that um some different bits and pieces here as far as options um things like the indepen into penetration check if you decide you don't want those systems you can just go ahead and use these booleans to turn them off there's one there for um falling through floor and there's another one here for the um vertical pulse which is the thing that angles you so if you don't want that just go ahead and untick this box and then it's gone so easy enough to tweak these systems the way we do our kind of selection system is all via that we have a trace that runs and does different traces depending on what platform you're on uh and then we have a select which simply fires from your input action uh and then it will fire these unselected events so very quickly we'll just show you in a building example we just have a simple system for um touch-based input and we have a system for this um interface based call and then we simply call this kind of jump to actor or jump to location and you can kind of explore this and definitely build upon this and down the bottom over here we've got this on camera arrived on camera left which is a great way to trigger uis and other effects like that because you don't want to trigger them until the camera has actually arrived on the building not while it's animating through the level so these are incredibly useful these two if we go over to our input system if you're not familiar with the enhanced input i highly recommend you have a little poke around in these these are essentially our actual input actions these are the things that get mapped in blueprint um our configs sorry our mappings first these are where they map those actions to a button so we have our keyboard and mouse we have our gamepad and we have these debug controls which is just one it's just the p key but we have it as a separate thing because it's true on either system so whether you're using gamepad or keyboard and mouse the debug controls are always available so if you open up keyboard and mouse you can just see we've got our different moves and we've got them linked with our different buttons uh we have secondary buttons so they can be remapped should you want to support that feature and these are all set up for player mapping like secondary interactions secondary mappings so you still need to build all the uis for that i've only done the half of the job because your ui is going to be unique to your game i can't build that for you um and then over in our configs this is what actually gets set um when you change input mapping so our keyboard and mouse for example we also map our keyboard and mouse system and our debug camera controls in our gamepad we map our gamepad and our debug camera controls hence why it's separate we can map those no matter what um and then lastly down the bottom we have widgets and we just got a very simple widget hud there's not much to be said about that so that's it really there's plenty um to play with and i think it's a good starting point for any rts camera system if you have any issues uh go ahead and join the discord have a little look through um some of the notes that are in this level and definitely have a play in this level to get a feel for it do have a look at some of the collision options we've got set on these boxes and so you can see uh kind of the different collisions and how they affect the camera because different ones will allow the camera to pass through or will allow the pawn to pass through so some things to play with there um and when you actually go to work with this project yourself you may wish depending on your use case to right click on this and create a child class and then start your work in a child class to keep your blueprints super duper simple um because most of this stuff here there's a lot of this stuff you just won't ever need to change and nearly all the options are exposed out as this options and a lot of variables that you should never change have been correctly flagged as private so they won't show up in your child class which keeps it nice and clean and simple to use um so that would be my kind of personal recommendation you'll still need to go into this parent class to make little tweaks here and there but if we just make a child class here and go to our defaults you can see we now just have all nice little set of options that you can just tweak very easily and a nice clean event graph to work from so that's that really i hope you find that um tool useful thanks for watching
Info
Channel: Aperture9
Views: 2,122
Rating: undefined out of 5
Keywords:
Id: CjlQFK5lfpI
Channel Id: undefined
Length: 12min 16sec (736 seconds)
Published: Fri Apr 15 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.