How to make VR GUN (unreal engine vr tutorial)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello friends sir fancy here and first of all let me show you what you can learn in this video I will show you how to create a gun just like this one let me take it you can see that it has much better grip than when you take a normal cube and what's even more important you can actually shoot with it so you can try to hit something and destroy it that's efficient you can well in this tutorial if you are interested keep watching I have started simply with VR project which means that you need to add your engine create new game and that game should be very short alloted and you are just creating a regular project you want no amateur so I believe that do you know how to do it and then I have imported simple 3d model of gana you can see right here and implemented some textures for it really simple everything as usually so after you have dead let's get to make it work in VR first of all let's get to virtual reality be able prints and that is VP pick up cube and that thing we need to duplicate so let's duplicate it and rename it to can under scroll PP okay then take it and put it back to folder where you are going to work in my case it's this folder gun which is right in back in content so now I can open it I go to viewport and look at this cube that doesn't look like done at all so you need to reset it to default and set it to our camera and our gun is not named a gun it's called police pistol so let's add here police pistol of course if you want to use same model as I do you I will give you a link in the description and wrestling for Sketchup or something like that ok now you can see it is in it but the problem is that it's bit too small scale is set to 0.2 so let's reset it again and see how it looks now ok compile it and let's test it in VR one more thing I almost forget we actually need to put it in the game so let's take it again and put it in the game now let's put it on table okay check it by simulating it if it is actually on the table no it is not so let's move it a little bit more and make sure that it is on table and you can see that physics and everything like that works just fine so let's switch it back to VR preview and play it with your VL has said just if you are interested I am using Coco's quest but it will work with any VR headset you can have okay now back in VR let's try to take it as you can see that it's bit small it looks like a simple toy so first thing we need to do is to make it much bigger but we are just guests like kids we will actually make sure that we have the right proportions and for that we will go to virtual reality BP doe brains and that should be H M AMD locomotion poem and that's not what we are going to open my bed sorry we are going to open VP motion controller I go to viewport and you will see here a hand which is that hint that you can see and you control with your controllers so let's click on it and make sure that you're clicking on that hand mesh and adhere component and that component will be mesh static mesh as it set and set it again to our gun okay again it's nothing again it's based on okay and you can see even though it is on one scale it's a bit too small so let's try to that seems like it would work but just to make sure that we it actually fits in our hand when it is hot so let's click on that grip click on that hand mesh and disable this anime use animation blueprint to use animation asset and that animation asset set to mannequin hand right get great and then you can click on your they stop and rotate it so it actually looks like it's on in his head I'm not saying that it is perfect but it's good enough so make sure that you know how it looks like and now what we will do is to compile it and then click on our I can be beam open it on second half of your screen here we go gonna be beam and I want it to have it and next to each other so let's take that gun and put it on the other corner of screen come on mate okay and in viewport of gun BP let's make sure that scale of that mesh is set same as here and right here if you click on it it is - so let's set it to two once you actually take it with your hand it will it will go exactly to the crepe which we have set up so that's the thing you can see right here let's move it a little bit and you can see all this transformation and coordination that it needs to be set to be in the den so I will go in gun bp2 event graph and you can see that that is already set up event pickup so for that vehicle to end of it and set in it you can see it right here and set it to set rotation no I'm sorry set location and rotation set relative location and rotation I believe and set that location as just as you I have on your on this set of coordination so if transform it's easy you just me can copy it and put it in it but with rotation I'm afraid that you will have to manually type it in another important thing is that you need to set the location row and rotation arrow to snap to target okay let's look at it compile and it's our target we just set our static mesh component okay compile I've taken it just from here and now let's close it all I have realized that I have actually made a mistake you cannot copy coordination which you have right here you need to take that static mesh and make sure that it's not attached to that hand mesh which means that you need to click on that hand mesh and make and see that it's not attached to it now if you if you can let's click all this I'm gonna call this always click which means that you cannot see it anymore anyway it will see that the coordination of that static mesh changed and these coordination you need to copy it to your blueprint so now you can see that I have done just that and the last thing I need to do is to delete it from I can so now I need to delete that can and make sure that our hunt mesh is set back to animation blueprint compile and click on play and now it should work just fine and it seems like it works wonderfully for me you can see that if I take it with either way and it fits exactly to do it to date coronations I have said which as you can see right now I haven't set up just correctly you can play with it much better but if you look from here it looks pretty cool ok so now what we need to do is to make that can shoot and that should be really simple for dead let's get back to our guns folder and create here new blueprint and the blueprint will be actor actor will be called but and open it ok and make sure that you adhere something that can actually shoot some mesh so them our mesh will be simply sphere let's put it right here and make it a little bit smaller because now it's huge set 0.2 and even now I believe it's quite too big people know it's a very big it can work for just testing it out so now we will click on that sphere and added simulate physics right here simulate physics and enable gravity oh that should be fine and just click on simulate different roofing works we can see it works just fine so next one is to set up input setting for that go to project settings and somebody should be inputs input and I'll tell you need to set a new one I have added it here but I will do it again for you there is action mapping can emit a plus one I'm going to pick calling it trigger and I feel and now it really depends on what kind of gr controls I have I have a cool or a cool touch because I'm using a coast quest and for that I'm gonna click on a close touch and adhere trigger a cool touch trigger right that's the one I need ok if you use HTC vive you can just add it here you can add here as many as you want which is probably recommended if you are making a VR game for on different platforms you can find the vive trigger and put it right here ok save it all so that's it so our plot appears when we press the trigger button for that we will go to our gun beep in and go back to Newport and add here an arrow ok component arrow and let's make sure it no no we actually need to have it like this scale it down so it doesn't look that terrible and let's rotate it ok make sure that you have snapping on so you can and put it right in front of your gamma ok the turns none because this will be position which we aware valve is power on our blood ok and now we need to set up your function so let's go to function you ok let's not call it new function let's call it shooting and other thing we will do here is to spawn actor from class that class will be our blood compile it and set bounds form which will be from our arrow we have set world transform excuse me everyone just said world location no I'm sorry we are not setting it away we need to get world location my bad click on spawn transform split structure pane and connect it right here ok compile and what we will do now is to set that you can do it with your trigger and for that we will need to go back to virtual reality VP blueprints and blueprint motion controller ok look at it just here and now that's actually not to be ha sorry you need to go to motion controller bound because that's where your camera is an already set up that is so let's look at it if you want but would recommend it and click right here and put here trigger which is that new action event we have created and when the trigger will be pressed we want to cast no actually are not going to cast we are going to get actor of class that class will be our gun or can be beam compile it and from there we want to call that function which is related which is called shooting ok compile it and it should work just fine when you press trigger which we set up in input methods it will cost to act and execute shooting okay let's test it out okay let's take it and see if it works just press it and it works wonderfully see every time I press this tanker button hopefully see it it creates it creates a bullet which is just wonderful and now we need to make it so that it actually shoots at anything which means we need to give it forward vector and that should be really simple we need just to code back to our gun to turn you can and vector but and when event begin play which means when it will be created that we will actually again get actor of class set it to our gun and from there we will take that arrow which we have created I believe it was still cold at all hopefully I haven't renamed it yes it is cold at all we'll take at all get at all and from there we will get its forward vector and we will add something to it because if it will take us if you just take forward vector it means it will take just where that arrow is headed well it is looking at which is exactly what we want but then we need to add it some momentum some speed so the times to float Oh actually let's used integer I just like them better and I believe it's a little bit less expensive entry job and start with 500 that should do the job and from our get actor of class let's put it this spin and take add impose to our sphere and it's and now you can just connect it impose compile it and see if it works okay fine well it is doing something and you can see that it is actually moving forward but it's really later so let's add some numbers to it and if you just don't know what you are doing the best thing you can do is to add here zero okay so they probably Bates too much but let's see take it and you can see that it is actually shooting much better okay so I put a little bit back okay and I can shoot those things and hopefully it will even interact with them yes seems like it does okay that's everything for me now I hopefully you can make your wonderful FPS shooting whatever game you want just it in VR you know and that's about it from me if you like this tutorial like and subscribe all this that would be very much appreciated but firstly something about me I'm so fancy I'm making videos on this YouTube every day mostly about game dev vlog how I'm making my games sometimes tutorials just as these and if you are interested in that subscribe hopefully we'll get something out of it see ya fancies are fancy out
Info
Channel: Sir Fansi
Views: 22,574
Rating: undefined out of 5
Keywords: unreal engine vr gun tutorial, unreal engine 4 vr gun tutorial, how to make a vr game in unreal engine, unreal engine 4 vr game tutorial, unreal engine 4 vr tutorial, unreal engine 4 vr tutorial beginner, unreal engine vr, unreal engine vr game tutorial, unreal engine vr tutorial oculus, unreal vr, unreal vr development tutorial, unreal vr oculus quest, unreal vr tutorial, how to make gun in vr, Unreal engine VR tutorial, Unreal VR gun, unreal engine vr tutorial, ue4 vr
Id: 4bb7gSNamZg
Channel Id: undefined
Length: 15min 40sec (940 seconds)
Published: Sun Apr 05 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.