How To Make A Rocket Launcher In Unity

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey what's up today we're going to be creating a rocket launcher so let's hop into blender we'll delete the default cube and go hunting for some awesome artwork to pleasure i mean use as a reference image yeah this'll do nicely back in blender we'll add a new much better not default cube we'll bring in our reference image and start blocking away and after a month of heavy procrastination this is what we've ended up with i found it much easier to model each part separately and then overlay them all i added some materials and i thought this color scheme looked pretty cool over in unity we'll start by adding a ground plane scaling it up and applying a cool looking material to it we'll need an fps character controller so using some tutorial section we'll follow this cool guide i found online so thanks to the sharpcoder blog i'll link it down below but in summary we'll add an empty player object pop a capsule in there resize and reposition move the camera into the player object reposition add a character controller add a player controller script and copy paste the sharp code after adding the code we'll need to drag the camera game object into the player controller we'll add some cubes for reference and test it out alright cool looks pretty good from blender we'll export the model in two parts as fbx first the body then the missile after copying the models into unity we're going to want to extract the materials so that we can apply any shader specifics like metallics and roughness because blender and unity shaders don't play well together we can then go ahead and drag our models into the hierarchy and start the extremely scientific process that is positioning the models correctly we'll char them to the main camera so that they can rotate with wherever the player is looking a pretty useful trick when getting to the finer details of the positioning is to drag the game window into a side by side position with the scene view so that we can see what the player sees as well and after fiddling for a bit this is what we have i think it looks pretty cool and we're ready to start with the fun stuff it's code we're going to use this missile in the scene as a kind of placeholder and if the player is able to shoot we're going to create a new instance of the missile at the location and rotation of the placeholder we'll then fire an event which is declared in the player controller to let any subscribed missiles i.e the one we just instantiated know that the player has fired and it can apply some force to itself in this way we separate any missile-specific logic from the player like i don't know pid control or something well let's test this out and see what it looks like so it shoots which is good but right now it's shooting the placeholder and the newly created missile so whilst i love procedurally generating things we're gonna rely on the animator here to help us with a few states first we'll need a state for when the launcher is loaded we'll call it rest loaded and its responsibility is to let the player know that they can shoot the next state is rest unloaded and in this state we'll just need to deactivate the missile placeholder the final stage will be the reloading state which will activate when the player presses the reload button and upon completion of the animation will return to the initial states rest loaded the reload stage requires the most amount of effort at the start of the animation we'll want to make sure the placeholder missile is inactive and that the launcher is in its rest position at around the 0.25 second mark will activate the placeholder and move it and the launcher into a reload ready position we'll hold that position for a little before sliding the missile in and lowering the launcher to its rest position we'll set up some trigger variables which we will use to trigger the states one to move from rest loaded to rest unloaded we'll set this in the player controller when the player clicks the fire button and one to move from rest unloaded to reload we'll also set this in the player controller just when the player presses the reload button so putting it all together let's test it that looks pretty cool i think the last thing we'll do for this episode is to add a reticle we can do that by adding a canvas with an image inside it we'll use the default knob image and center it in the middle of the screen and that's a reticle done i'll leave it at that for this video mostly because i've been faffing around for about two months without having released any content the next one will be about targeting systems and explosions and stuff i'll probably release it in a year's time as usual the codes linked below do the likey likey and the sabisabi kay love you bye
Info
Channel: Tvtig
Views: 13,498
Rating: undefined out of 5
Keywords: Unity3d, unity tutorial, unity game dev, game development, how to unity, unity rocket luancher, unity RPG, how to code in unity
Id: dKVfpXrnRwY
Channel Id: undefined
Length: 4min 21sec (261 seconds)
Published: Mon Jul 05 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.