3D Movement for 2D Sprite Character - Unreal Engine 5 Tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
i've been getting a lot of requests on making a tutorial about moving a 2d sprite based character not just left and right but also back and forward this is the type of movement system you generally see in side-scrolling beat-em-ups and it's actually very easy to implement so this is going to be a short video you will first need a paper 2d character that can move left and right if you don't already have this i recently made a tutorial about how to set up a simple 2d game in unreal engine 5 which you can check out i will be using that project as a base for this video but i'll use a different sprite for the sake of visual variety first we want to change the rotation of the spring arm on the y axis to get a nicer perspective looking at the character slightly from the top we might also want to adjust the target arm length as you can see we can move left and right by pressing a or d the notes that allow us to do this are on the event graph of our character blueprint we simply take an input that we defined in the project settings in the prior video and pass the axis value to the add movement input node the world direction on x is set to 1 which determines our movement direction to also enable up and down movement we need to go back into the project settings and select input here we want to add another axis mapping for move up since we want the w key and the up arrow key to have a positive value we leave the scale at 1. for the s and down arrow key we want to set the scale to -1 to signify that we want to go the opposite direction back on the event graph we can now add a note for input axis move up that we just set up in the input settings then we again want to trigger the add movement input node however this time we want the world direction to be -1 on the y-axis [Music] if you try to move up and down now it might already work for you depending on your character movement component settings if it doesn't work select the character movement component and search for constrain we then need to remove the check mark from constraint to plane to allow the character to move up and down our character can now move up and down however there is one more thing we can easily improve if you look at other games you will notice that the movement for up and down is generally slower than left and right we can easily change this by multiplying the axis value we get on move up by a number that is smaller than 1. i'm using 0.6 here you can see that we now move up and down at a different rate than left and right to make this easier to update we want to promote this value to a variable and can then easily change this movement rate by updating the default value we have now reached our goal of implementing smooth movement on two planes there is one limitation with this setup though which becomes apparent if we rotate the player's start by about 90 degrees even if our player starts facing in another direction in the world the moment we move the original direction is ignored and we start running right again this is because we use hard-coded values for the world direction and also we're changing the control rotation even though it is possible to make all of these things depend on your spawn rotation so you become able to walk in any direction it gets pretty complicated quickly and is most likely not worth the effort for most games all side scrollers are built with the assumption that you always want to move from left to right or right to left so making our game with the same assumption and adjusting the map to fit that will save us a lot of headaches i hope you learned something useful in this tutorial if you want to know how to make your sprite character affected by lights and shadows in the world i already made a tutorial about 2d 3d hybrid games that covers a lot of these settings related to that you can check it out here
Info
Channel: Cobra Code
Views: 29,964
Rating: undefined out of 5
Keywords: game development, unreal engine, gamedev, ue4, ue5, game dev, paper 2d, paper 2d unreal engine 5, unreal engine 2d, unreal engine 2d movement, unreal engine beat 'em up, unreal engine side scroller, unreal engine 2d beat em up, beat em up movement, beat em up tutorial, beat em up unreal engine tutorial, unreal engine beat em up, 3d movement 2d sprite, 2d sprite movement unreal engine, three dimensional movement 2d sprite, ue5 2d, ue5 paper 2d, ue4 2d, ue4 paper2d
Id: 59hgD6q7j1k
Channel Id: undefined
Length: 3min 55sec (235 seconds)
Published: Wed Jul 06 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.