VR gun tutorial - Beginner unreal engine VR tutorial

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

This post appears to be a direct link to a video.

As a reminder, please note that posting footage of a game in a standalone thread to request feedback or show off your work is against the rules of /r/gamedev. That content would be more appropriate as a comment in the next Screenshot Saturday (or a more fitting weekly thread), where you'll have the opportunity to share 2-way feedback with others.

/r/gamedev puts an emphasis on knowledge sharing. If you want to make a standalone post about your game, make sure it's informative and geared specifically towards other developers.

Please check out the following resources for more information:

Weekly Threads 101: Making Good Use of /r/gamedev

Posting about your projects on /r/gamedev (Guide)

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

👍︎︎ 1 👤︎︎ u/AutoModerator 📅︎︎ Sep 20 2020 🗫︎ replies
Captions
hello there i'm sarfanzi and welcome in this tutorial where i will show you how to set up vr gun with reloading system let's of course start with looking at what you will end up with because everyone hates tutorials where you don't know what it will be so you can see that you can pick up that weapon and on the top of it it will show you the amount of ammo that is left and right now it's zero but if i reload it just like this it's set to seven and now with trigger button i can shoot whatever i want and reload it again important thing is that i'm using vr expansion plugin so if you don't have it yet don't worry it's for free you can download it and i have a video for that and also a few more tutorials if you want to learn more all in the description so let's get to it we will start in blender because we need to prepare our mesh a bit if we want to use same gun as i'm using it's from 3d model heaven you have link in the description it's for free you can use it for commercial game blah blah blah you know all that stuff so let's get rid of it and look at that mesh so important thing is that it needs to be separated to two different meshes first one will be block glock body and the other one is just a barrel barrel needs to be separated simply because we will want to move it like this and reload it you can of course separate as well this one which means magazine if you want to have it movable and changeable and all different stuff in this tutorial i will work only with barrel so let's select it all and export it somewhere and now finally in a new engine i'm using same template project that i've modified in previous tutorials and let's import here our glock or whatever weapon you are using let's go in meshes in basic content browser and we will put here this glock you can import it just as it is it's not a skeletal mesh even though you can play with it as a scuttle mesh for example if you were doing cross world so what we will do is to find this pickup cube that's my favorite base blueprint right click on it and browse to asset that will find it for us right click on it again and duplicate it let's call it gun or to be precise bp under scroll gun i wanna hide b set enter and put it into aaa files which is folder i created before all right now what we will do is double click on it and first of all we will need to change this static mesh component and we will change it to new gun which i believe was called glock and we will use glock body and you can see it's a bit too small so let's resize it to one and we have different materials so let's just click on this yellow arrow if you are using your own materials which you probably should it wouldn't look that nice unless you are doing super hot or something like that to be have it just right let's put it in the game and i'm afraid it will be still a bit too small oh maybe not we will see so what we will do now is to maximize it and click back on viewport right here and we will add one of the components from vr expansion plugin so let's put here vrs okay let's just put here slider and it is vr slider compile and we will adhere the other part of the clock glock barrel and it fits right here look at that click on vr slider and what we will do here is to adjust the slide distance it can travel right now it's set on x-axis but if you look at it x-axis is this red one and we want to move it along this green one which is y so we will set x to zero zero we could eventually say this one but in that case it would move forward which we don't want so what we will do is to set it right here in minimum slight distance and we will set it to let's say -150 and the only thing we can do now is to test it of course and you can see that i was right it's bit too small so let's take it like this and what we will do is just test this magazine no it's not the magazine just this moving part so we'll take it and move it okay way too back so we will need to adjust a lot of way a lot of things here but general idea is that it works look at that well it does not but you know what i mean let's get back to it so we will start by scaling it back up well not a backup but up and here click on static mesh component which you could rename if you want oh you actually can't it's inherited doesn't matter let's scale it to you know what actually let's do two times this will be probably overscaled but we will at least see everything better oh that's fine and the other thing was that it was moving way too back this minimum slight distance let's try like -50 and another thing we can do just to make it a little bit easier for us now is to click on the static mesh component and disable the simulink physics so right now thanks to this code setup it will simulate physics only after it was held so it will be simpler to pick up from the start okay it's way too big but it doesn't matter we have testing stuff out we will kind of move forward and let's click on vr slider and and we will click on on slider finished uh larping i hope so and we will print here print stink and that string will be our final progress just to see how it is set it to let's say minus 5 should be fine i believe and one more thing here i used the wrong note note node we will have to use on-site right point and just change it it's on slider finished delete it and connect it just here now let's test it pick it up and let's move it and you can see that it works much better and it also showed us some value on the left up corner which you can see on the screen much better than i do but i believe that if i move it forward it's on one and if i move it back it's zero yeah we will need that for later it's surprise tool that will help us later all right just a quick fix static mesh component set scale to 1.5 and maybe we are slider set even lower -4 uh and that's about it we don't need to take care about anything else right now because we will start shooting because before reloading you need to shoot your ammo out so for that we need to go back in aaa files and vive pawn character which is just regular pawn that i am using for from this template let's double click on it and we will have to use some input i will actually create new one just to make it simpler let's go to update project setting input and we will add here action mapping click on that plus button let's add here trigger under scroll shoot 360 no scope let's just sound that sounds about right and as that button with a set trigger and i'm using oculus quests so it means in my case in that means in my case it will be r trigger because i want to shoot only with right hand but if you are using different headset you need to find your triggers basically so a close touch r trigger let's actually put it under scroll r or i can you know what let's simplify it we will be able to shoot with both of these triggers let's add here new one and just put here oculus touch left trigger left trigger right here oh that sounds good so now back in our vive pawn we will do is to go into event graph this all looks nice but we are not gonna do anything with that right click and what i will do is find our input which was called i believe trigger under scroll shoot under scroll 360 no scope that's about right and from there we will get actor of class that class will be a gun pp gun and if you have different guns or if do you want to have several types of guns you can use tax system that generally fix it or differ just different blueprints all up to you so to do compile and from there we will take event but that event hasn't been created yet so let's open bp gun right click and we will are we in event graph make sure that we are we look at the custom event and custom even will be shooting should that just shoot it and after that what we will do is to create actor from class create actor from class and that actor we need to find we actually already have this some some actor in this template and you can simply find it if you click on this gun base that has been added by creator it will be somewhere here first person project projectile if you click on it we can find it and see that it is just set simple projectile with collision component so if you want to add your own you can look into that how to set it up super simple so let's click on gab no we will actually we will click back on gun and right here we will spawn first person projectile wonderful now we need to also set up okay let's deselect it right now compile and we need to set up spawn transform for that so let's click on viewport and we will simply add here an arrow sir that will work as a reference for spawning something it's bits too big so let's scale it down and put it there from where you want to shoot usually that's something right here in front of the weapon so let's put it into 90 degree sounds about right go to event graph take it get world transform right click on return values please structure pane again split structure pin and we'll connect on the location and rotation because we have changed scaled in this arrow so that should be about right and connect it right here so now what it will do if oh of course first of all we need to get back to our live pawn character and take it from here and just shoot so now what it will probably do which we can even test without putting headset on hopefully is that it should just shoot just like that if i press the trigger and as you can see that once i press any of these triggers it shoots these wonderful weird balls which is kinda weird because i don't have it in my hand as you can see and we will fix that right now let's get back to aa files and we will click on bp gun right here you can see that it will shoot just anytime it takes that input which we won't change but we will add here and branch and that will simply ask is it in hand and we already have set up some conditions for that you can see that if you like if you look not don't lick it guys don't lick it after this event set health it sets grip to true which is variable that we will use right here let's simply connect it here that means once this weapon was will be picked up it will enable it to spawn this shoot thing but it's not everything of course it's super simple to set it set it up like this so now we will set up sort of a reloading system after moving this back so for that we will need to create new variable the variable will be a mob and we will set it to float and let's set default value to zero it's fine and actually integer will be better but it doesn't really matter so what we will do here is is to use this hit point vr slider and if you remember we set it up or it shows us that if you move it back it will set it to zero this value which it will create the slider progress point so it will set it to zero once it hits this minus four point and set it to one once it hits this zero point and we will use exactly that so let's go here and put here branch delete this string and don't need it anymore even though you can use it for testing still of course and let's take this slider point and we want it to be even to one equal float so let's set it to equal float and then equal float should be one then connect it to condition and once this will be set to true we want to set our ammo to seven i'm not even i'm not sure if glock has actually seven bullets i think it has a bit more isn't it 13 whatever just press the like button and let me know how many more mission ammunition does glock have right time to stop wasting time and go back here because we will add one more thing and that's text under this component let's scale it a bit down zero point okay like do at maximum rotate it a bit and put it right here because i want here to have some sort of a thing that will show me how much i'm on issue i mean ammunition ammunition whatever that is i still have so let's put it here and what we'll do is let's put it here and we will actually put it under vr slider because i wanted to move with this slider you don't need to all up to you and we will do here is on event again play which we don't have here so let's add it and begin play move it down here even it should be probably up because it's begin play on start all right i'm public again so we will take this text and set it to set text and the text will be set to this ammo okay come on mate get ammo and connect it right here all right to text and let this i think as it is okay compile and connect it here and because i will use it quite often i will just convert this to macro or just note let's simplify it and i will set it to set ammo to text oh come on can i even spot text double click on it and also set here output pin because we will we may possibly need it later and now back to event graph so now what we will also do is to change the text every time you shoot so let's go here oh no no what am i doing copy it paste it and put it here again and i'm thinking about it now macro would be probably better but it's not really important to be honest so this thing will always change the text right here back to our remaining ammo but we also need to set our ammo once you shoot so that means we will go here and set our text so take ammo put it here come on it take it here set it and take it one more time and get it this time i will set it ammo minus float minus float which means i'm a minus one somehow put it there and connect it before this oh no no no no no what am i doing we will connect it to this compile and one more thing we need to do is to check if it has enough ammunition for it to shoot so we will add here another branch let's just copy this one but we will change the condition of course again it must be set to true move this all down and what we will do here is take our ammunition get it and we need to make sure that it's bigger than zero i believe once it is bigger than zero you can shoot so from the start you won't be able to shoot unless you reload oh and it should by default set our text to this hopefully everything works just as it should and let's test it out and see if i'm not just lying to you all this time all right now in vr time to test it let's take it up and you can see that we already have here this text even though it's kind of off doesn't matter well it does but let's ignore that also if you want to have a better grip than this like two finger holding a weapon i have a tutorial for that you can check in the description and in the tutorial you can also learn how to take off this magazine put it away put a new one add some additional things to that etcetera etcetera but we are here for testing this thing so now if i shoot nothing happens so let's take this move it back and back forward and nothing happened but we can shoot and i know why nothing happened it's all right because once i shoot you can see that text with ammunition was changed i can shoot few times do something really weird with that car now i can shoot anymore but the last number here is one which shouldn't be so we'll fix that in a while but if i reload again i can shoot again so first just aesthetically let's change the space of this text i want it to have in right middle of it so you can see that oh right location here was zero so for that we will need to y set it to zero as well and the next thing was once you reload we want to of course set ammo to text hit point slider there we are setting a motor seven so we also need to set it to text so come on why is it two of them don't click on it i really should have used macro my bad and compile it so the thing why it didn't shoot on one was because it was set that must be bigger than one which it isn't if it's one of course so we simply need to change it to either set this number to zero or set here equal or bigger or equal than a one so we will set it to zero even though usually it's better to use the equal sign now let's test it one more time if it works now i can choose by the way text is still kinda weird to do something with that reload set to seven do seven shots shot all of seven shot shots this time around reload works just fine i can shoot doo doo doo you can of course add another conditions if you want to also change the magazine before reloading etcetera etcetera you should be able to do that by yourself without any problem alright that's about it i hope that this tutorial was helpful for you now you can reload your gun and do anything you want if you also want to add attachments to your weapon and change that magazine blah blah blah i have tutorial for that link in the description and somewhere here was definitely i that you could click on etc i hope that this tutorial was helpful for you that's about it from me i'm sir fancy and i'm leaving i usually say i'm out but i'm gonna be in this time around alright i should really quit it see
Info
Channel: Sir_Fansi Gamedev
Views: 6,702
Rating: undefined out of 5
Keywords: ue4 vr tutorial, unreal engine vr tutorial 2020, unreal engine 4 vr tutorial beginner, ue4 vr locomotion tutorial, ue4 vr teleport tutorial, ue4 vr expansion plugin tutorial, vr expansion plugin, vr expansion plugin ue4, vr expansion plugin tutorial, unreal vr tutorial, unreal vr development tutorial, unreal engine vr gun tutorial, unreal engine 4 vr gun tutorial, unreal engine 4 vr tutorial, how to make gun in vr, Unreal VR gun, ue4 vr, unreal engine 4 vr, unreal vr
Id: HzHbcS1zN78
Channel Id: undefined
Length: 20min 7sec (1207 seconds)
Published: Wed Sep 09 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.