Creating a Locomotion VR Character - Unreal Engine 5

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so last week 195 was released in early access and they made a lot of really nice improvements especially for vr however there were a few little annoyances that definitely got to me and i definitely weren't quite as fond of one of them being the way that the player is developed in the unreal engine 5 vr template the main annoyance i have with this is that they made it a pawn again like they did an unreal engine 4 which is great if you're trying to develop a any kind of game or anything like that that uses teleportation however it's not very great if you're trying to implement any kind of locomotion movement or anything that you might find in a typical vr character and the simple reason is is that a pond doesn't have any sort of basic gravity or anything like that attached to it like a character would so in this video i'm going to show you guys how to create a differently designed character so that way we can actually implement locomotion movement along with teleportation movement should we decide to later on so with that let's go ahead and jump right into the video all right so i've gone ahead and opened up a new project um i did a little bit of cleaning out to our base template maps that way we have quite a bit of room to work with so you can see i've gotten rid of all the cubes the guns that would have normally been here um i've also this is something i especially want to bring note to i did also remove remove the player starts and i'm going to bring in the player character that we're going to create and auto possess it once we have that created we're going to start by creating our our vr character uh here in our in our project so to start out let's go ahead and create a new folder real quick and i'm just going to call this blueprints [Music] open that up and we're going to want to create a new blooper and class that's a character now this is the parent plus that we're going to be using for our character um as i said i prefer this much more than using a pawn the pun is good for teleportation but it's not really good for any other forms of movement or anything like that which is why i which is why we're actually using a character to develop this uh this new vr player all right so to start out let's go and add in a couple of components that we are going to need first we're going to need is we're going to need a camera now this will automatically tie to our headset so we don't really need to do anything here it will all work just fine just as it is but we will need to make a couple modifications to these next two components and these are going to be motion coolers and i'm actually going to create two of these and call motion left and motion controller right and actually i'm going to un um i'm actually going to detach these from the camera and detach d and attach them to our capsule component instead um so starting with our motion controller left we're going to want to do is um first things first we're going to go down here to visualization and i'm actually going to hit this display device model and custom and i'm actually going to look up real quick vive control pre-controller mesh now this is actually going to give us just a very generic mesh that we can use to make sure our controllers are tracking correctly um i'm not actually using a vive wand i'm actually using a valve index however there is no valve index at least currently in early access i don't know if there's a plan to add a valve index model um but the next closest thing is using a vive wand i do however believe that there are um other types of controllers that you may be able to bring up like i believe you may be able to bring up oculus yes you can there is an oculus mesh if you'd like to instead or if you have a static or skeletal mesh that you'd much rather use you can also attach them as um as components to your motion controllers i'm not going to worry about that since i'm just trying to show that this is working so that way you guys can modify this to your liking all right um and then we don't need to do anything else to the left hand but we will need to do an additional step to the right hand so let's go and start off uh add in our custom model again and we're going to do a vive pre-controller mesh and the different thing we're going to do with our right controller is right here where it says motion source you can see it says left now this is going to be whichever hand we're actually going to be using to actually track this particular particular motion controller we clearly don't want to use the left hand to track the right motion controller so what we're going to do is we're actually going to set this to right and it will then allow for our right controller to uh modify the position rotation all that of our motion controller right component next thing we're going to do is um we're going to go ahead and create our interfaces real quick um now you don't have to use an interface specifically um let me actually go and create this folder click interface and we're going to create our it's going to be under blueprints and blueprint interface and i'm just going to call this tripable interface now before i go and open this and start modifying this you don't have to use an interface specifically if all of your components are going to be grabbed the exact same then you don't need to worry about using the specific interface however in some cases you may want to be able to grab different components slightly differently so for example maybe you have a cube that you would like to maintain whatever location rotation and scale it originally had from the hand whereas you may have a different component where you'd like for it to immediately snap to a socket maybe a component something like that so this will just kind of give us something um this will just kind of give us an interface that way we can kind of generally uh call this call functions within this interface um and have them work correctly with whatever actor that we want so with that being the case um i'm actually going to i've opened this up we're going to need two functions first one i'm going to call grab and the second one i'm going to call release this is all we're going to need for uh these scriptable interfaces um and then going back into our blueprints i'm also going to create one more blueprint class this one's going to be an actor and we're just going to call this drippable after all right i'm going to do that and we're going to go and bring that right up here with everything else i'm actually going to close the scriptable interface because we don't need to do anything more to that anymore all right so first things first let's go ahead and implement that interface we created to the scriptable actor so we're going to go over here in the class settings and what we're going to want to do is right over here where it says interfaces under implemented interfaces we're going to want to add and we're going to bring up grippable interface and that's that um the other thing we're going to do is we're going to want to bring up a static mesh and i'm just going to leave it called static mesh and i'm going to then um rename or i'm not not renaming i'm going to set it to a cube so this will give us a nice simple cube that we can use and attach it with um actually occurred to me i might have forgotten something in the interface but we'll come back to that in just one second um so let's go and remove all this go on compile save that and we're going to go ahead and uh jump back over into our interfaces real quick because i actually did forget something um i actually want to for a grab go ahead and add in an input and i'm just going to call this uh component and what we're going to do is whenever we we grab something we're essentially going to be calling a function within our grippable actor um and so we're going to want to grab our motion controller components that way we can actually attach to it from um motion control object reference so that way we can actually attach to it from our grippable actor so go and save that now we don't have anything more that we need to do in there all right so let's go ahead and bring in our grab and if i recall it's going to be grab call function no it's not call function hold on uh there it is i'm going to grab and we're also going to to call in release and that's going to be event release you can make sure that they're correct as well because you'll actually see it says from grippable interface so that's how we also know that we're bringing it from the correct interface if maybe you have multiple interfaces or whatever the case may be um so that being the case um so what we're going to do is we're going to just real quick uh add in right here so we can attach actor to component and what we're going to want to do is we're actually going to want to attach to ourself to the component that we're passing through here there we go and i'm actually going to do keep world on all of this um yeah we'll go and keep world on scale too and that will allow for us to attach our grippable actor to our component um which in this case will be whichever motion controller we pass through and that will all work just fine um i'm actually also going to create a variable for this so if i actually drag off i can actually promote to a variable and there we go and i'm actually gonna rename this real quick to motion controller this will allow for us to just very easily reference it uh when we come down here to the release we can go ahead and check first off we want to make sure our motion controller is valid [Music] otherwise we may get some errors and things like that if it's not valid and we try to detach it detach from components [Music] there we go and if it is valid then we're going to want to do all this and we're going to keep world on all this again and we're going to compound save that and that's pretty much all that there is to that that's everything that there is um so now that our grippable actor is all set up we can now jump back over to our vr character and we can then set up our grab and we're also going to set up some locomotion movement as well over here um so let me go ahead i'm going to remove all of these nodes and we're going to go and start by uh let's see first what our inputs are bound to so we can make sure everything is all tied correctly so starting with the grabbing these are going to be action mappings and you can actually see that we have grab left and grab right and you can actually see what it is they're tied to so um for my case i'm using a valve index so you can see it's tied to valve index left and right grip axis if you're using an oculus controller it will be oculus touch grip um any sort of mixed reality or live controllers those will be a grip on those as well so we're going to start by bringing those so let's go ahead and do uh what was it grip left grab the left there it is and we're also going to want to do grab right okay and then just to make sure we have all of our inputs already brought over here all of our mappings we're also going to want to have something that way we can control our locomotion movement so for this we're actually going to use our movement axis left and we're going to want to grab both our x and or y these will be tied to our left controller so this is my left controller these will be tied to our left control our x will be our left and right on our thumb stick and our y will be our up and down on our thumb stick there as well um and you can see it's also tied to other thumb sticks as well so it's going to be the same case if you're on a oculus touch if you're on a vive so on and so forth so um that out of the way we're going to do movement in ah there it is movement axis left x and then take my right my right click there we go movement axis left y and there we go all right so we're going to go and start with our grabs and actually something i did forget is we are going to need a couple of collision spheres for these that way we can actually check to make sure that there is something there um so we're going to do sphere left sphere left and i'm actually just going to duplicate that and call it sphere right i'm just going to drag this right over to our mesh controller right and you can actually see that these create a couple spheres um that we can actually use i'm actually going to decrease these radiuses a little bit too maybe just it's like 20 i think 20 is pretty good there we go all right so on press first thing we want to do is we are going to want to check to see if something is being gripped there so um or if there we'll first want to check if there's something we can't grip so uh get overlapping actors and um we're going to want to do is we can actually do a class filter if we like um however since we're basing it off the interface what i'm actually going to do instead is i'm actually going to run this through a for each loop and check to see if there's if there's anything that actually implements the groupable interface so we'll do this implement does implement interface and we want to check to see if it implements the grippable interface and if it does then well actually first we have to run that through a branch all right and then if it does which will be our true case what we're going to want to do is we're going to want to run our grab right here grab message and that's going to be on our our array element which will be whatever element is being passed through at the moment and there we go and our other thing we're going to check is our component which is whatever component we're going to be attaching to which in this case is going to be motion controller left i'm going to do one more thing as well so that way you can easily reference these later on as well i'm actually going to take this let me first go and reroute that node and i'm actually going to promote this to a variable and i'm just going to call grab left this will offer us once we come here to the release and we're actually going to again here check to make sure that our grab left is valid release there we go and then if it is valid then what we're going to want to do is we're going to want to take our grab left actor and we're going to want to then run the release message on it and that's gonna be all that so it seems like quite a bit it's actually not that difficult to be honest um it's just quite a bit more than what you might think it would be so i'm rather than uh rewriting all this for our right actor i'm just going to copy all this actually that's the wrong button and i'm actually just going to do some modifications to this that way it'll work with our right actor instead so i'm just going to take our sphere right here and delete that and then i'm also going to rather than use our grab left actor oh hold on um we're going to want to we'll actually start here too because we also need to take our motion controller right here um and i'm actually going to delete this i'm going to promote to a new variable and this one's going to be grab right after and we're going to take our grab right actor and pass that through here so that will be all of that all right so that is all the grab functionality implemented the last thing we're going to implement is going to be our movement which is actually not that difficult so what we're going to do is we're going to want to right click and look up input and what we're going to actually do is where is it where is it add movement input there it goes so you can actually see so i do want to bring your attention to something real quick so you can actually see it mentions that the target is a pawn this functionality is actually implemented in a pawn however the issue is that pawns do not implement gravity at all if you want to implement any sort of gravity you have to manually input that through maybe tick or maybe if you can figure out some way to do it through a collision um something like that because it does not apply gravity to ponds which is why we're actually doing this through a character if we actually go over here to our vr character we can actually look up gravity there it is uh under character movement my bad uh we can actually go under character movement and we can actually see that we have a gravity scale which means that gravity is being implemented to our character here and as you can see we can also increase the decreased gravity so if we want to disable this we can just set our gravity scale to zero and we will no longer have any gravity implemented and vice versa we can also increase our gravity and have it so we fall much faster we can also decrease our gravity scale to make us fall much slower so on and so forth so we're going to do is we're going to add movement input and for for this we have a couple different ways we can actually get our world direction so we can first off grab it from our camera i'm going to grab it from our left controller since this is what's going to be controlling it and it's just going to be pretty simple to implement and i'm actually going to get forward um oh no this is right uh get right vector because this is x so this is going to be our left and right and we're going to want to add that into our world direction and then our axis value gets gets set into our scale value so the way that this will work is our world direction being set to right means that whenever we move our thumb stick to the left for example um or i'm sorry this is right this is left from my perspective uh to the right um then what will happen is it will actually get our right vector which in this case will be going out this way and it will actually and it will actually move in that direction based off our scale value so if it's in the center it's not going to move at all because our scale value is zero so it's not going to move in that direction if we move it to the right it's going to be positive which means that we will move in that direction fully or partially depending on how much you have pulled and if we go to the left that's going to be a negative axis value so we'll be going the opposite direction at whatever value we're doing it's going to be very similar for this as well so let's actually uncopy this however rather than doing get right vector what we're going to do is we're going to want to get forward vector okay and delete that and add in our scale value now like i said this will work the exact same way the only difference is that now it's going to be based off of the forward vector which will be coming out this direction and it's going to do the same exact thing if it's up that's a positive value so we'll move forward if it's down that's a negative value so we'll move backwards from wherever our left hand is pointed and with that that is everything that we need to implement some basic functionality that implements our grip um our release and it also implements some basic locomotion movement so i'm actually going to go ahead jump right over here into our vr template and i'm going to button i'm actually going to go ahead and drop in our vr character there we go um oh i actually forgot something on our vr character um i actually did forget something our vr character our capsule component we actually need to decrease our capsule half height to i'm actually decreasing to one by one and the reason being is that our capsule half height is actually like our anchor for our character and so um we actually need this to be right down at the ground level um otherwise it'll actually push our camera up so i'll actually leave it off the ground though because it will allow for it to fall down to the ground and make sure our gravity is working um i'm actually going to test that through another method as well so let's go and drop in our grippable actor as well i'm actually going to decrease the scale on this uh transform locker scale and i'm actually going to decrease the scale we'll do like point two maybe i think point two is pretty good um and actually something else i want to make sure of too we also want to make sure that we have um no physics or anything on this um which it doesn't look like we do which is good we do not okay um so let's go ahead and jump back over here we're going to auto possess we're going to auto receive inputs on our player and i'm actually do one more quick thing going right up here to create i'm actually going to drop in a plane right up here along our left side let me go and rotate this a little bit this will just kind of give us something so that way we can move up and down it so that way we can make sure our gravity and all that is working correctly and our locomotion movement will work correctly on slopes as well um and with that that is everything so i'm actually going to go and boot up boot this up and we're going to go and jump in and uh double check make sure everything is all functioning as it should be it took me a second i had to restart steamvr um unreal engine 5 of course is still in early access so there are of course glitches and stuff to be expected teamvr just wasn't working right um so i had to restart that um but anyways so look at this um so here's our grippable cube so you can actually see i can actually grab it move it around and as with either hand um there are no issues whatsoever here um so the only thing is that um it probably would have been better if physics were then simulated to fall again however it just seemed like a little bit lengthy for this tutorial i was trying to keep it as brief and simple as possible um but that is certainly an option if you would like to simulate physics again on release it would just be a matter of uh altering the release function in the grippable cube now the other thing of course is movement so movement is working as expected so i can actually do forward there we go forward it does kind of throw me off because this actually isn't rotated correctly to my controller so but you can also see too i can do right and left and all that kind of stuff and i can also angle it to other directions as well to move in that direction now you can also of course modify this to move based off of the headset if you want to move it based off the right controller maybe you have some other tracking method that you would like to use there are of course other methods that can be used as well um but anyways and then we can also see too i can actually go up this slope you can actually see i'm actually rising and lowering with the slope which isn't something you could do with the pawn unless you were unless you were simulating physics as i had mentioned before now another thing i do want to note is this does not rely off of navigation like teleportation like the teleportation does so you can actually see right here this is actually no teleport zone i did not modify any of this too by the way so the cube is still here and actually i think it can actually show navigation as well let me see if i can remember the show navigation ah it's a lot more difficult with controllers on than you might think there we go so this is actually a navigation um nice little tip if you didn't know how to view navigation you can actually see it it's uh it's over here on the slope as well um we can actually see this is a you otherwise wouldn't be able to teleport here um and that's not the way that the locomotion movement works this actually works based off of um just general locomotion movement whereas the teleportation relied off of navigation to make sure that you can actually teleport there so that's kind of interesting but yeah so um that is our character all set up all right with that that is a very simple alternative to the default vr pawn in the vr template for unreal engine 5. i definitely prefer this kind of implementation much better than what the standard vr pawn does especially since it's a lot more limited in what you get right out of the box um the vr character you like i said you automatically have gravity gravity implemented um and all that kind of stuff and it's really not that difficult to implement even more features into it either so i overall find the vr character just to be a much better implementation over using a pawn um so with that that is it for this video if you would like to support vr playground in any way be sure to hit the like and subscribe button down below and with that i will see you guys in the next reality
Info
Channel: VR Playground
Views: 4,899
Rating: undefined out of 5
Keywords: VR Playground, VR, Virtual Reality, Game Development, UE5, Unreal Engine 5, VR Locomotion Movement, Unreal Engine 5 VR Locomotion, Unreal Engine 5 VR Character Redesign, Improved Unreal Engine 5 VR Character, unreal engine vr locomotion, unreal engine vr character redesign, improved unreal engine vr character, vr locomotion tutorial, vr locomotion, improved vr character, unreal engine improved vr character, vr grabbing objects, vr grabbing unreal engine
Id: JRMEzqOHJ5U
Channel Id: undefined
Length: 27min 37sec (1657 seconds)
Published: Fri Jun 04 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.