{"id":199,"date":"2024-03-05T06:23:09","date_gmt":"2024-03-05T06:23:09","guid":{"rendered":"https:\/\/wildtechgames.com\/?p=199"},"modified":"2024-03-09T19:52:04","modified_gmt":"2024-03-09T19:52:04","slug":"my-unreal-engine-learning-journey-day-32-weapons-weapon-pickups-and-blueprint-logic","status":"publish","type":"post","link":"https:\/\/wildtechgames.com\/?p=199","title":{"rendered":"My Unreal Engine Learning Journey \u2013 Day 32 \u2013 Weapons, Weapon Pickups, and Blueprint Logic"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Introduction:<\/h2>\n\n\n\n<p>Today I added a weapon, weapon pickup, and some logic for the game to know which item the player is attempting to pick up.  <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"732\" src=\"https:\/\/wildtechgames.com\/wp-content\/uploads\/2024\/03\/image-8-1024x732.png\" alt=\"\" class=\"wp-image-201\" srcset=\"https:\/\/wildtechgames.com\/wp-content\/uploads\/2024\/03\/image-8-1024x732.png 1024w, https:\/\/wildtechgames.com\/wp-content\/uploads\/2024\/03\/image-8-300x215.png 300w, https:\/\/wildtechgames.com\/wp-content\/uploads\/2024\/03\/image-8-768x549.png 768w, https:\/\/wildtechgames.com\/wp-content\/uploads\/2024\/03\/image-8-1536x1099.png 1536w, https:\/\/wildtechgames.com\/wp-content\/uploads\/2024\/03\/image-8.png 1608w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Weapons:<\/h2>\n\n\n\n<p>Although this is an Unreal Engine Third Person project, I was able to choose a generic gun from the Unreal Engine&#8217;s built-in First Person default assets profile and attached it to our players right-hand.  I positioned the gun mesh so that it looked somewhat realistic in the players right hand.  I also added a simple sphere mesh that is used for the projectile that will originate from inside the gun a barrel. I&#8217;ll add the actual firing function to the game in a later tutorial.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"658\" src=\"https:\/\/wildtechgames.com\/wp-content\/uploads\/2024\/03\/image-9-1024x658.png\" alt=\"\" class=\"wp-image-202\" srcset=\"https:\/\/wildtechgames.com\/wp-content\/uploads\/2024\/03\/image-9-1024x658.png 1024w, https:\/\/wildtechgames.com\/wp-content\/uploads\/2024\/03\/image-9-300x193.png 300w, https:\/\/wildtechgames.com\/wp-content\/uploads\/2024\/03\/image-9-768x494.png 768w, https:\/\/wildtechgames.com\/wp-content\/uploads\/2024\/03\/image-9-1536x987.png 1536w, https:\/\/wildtechgames.com\/wp-content\/uploads\/2024\/03\/image-9.png 1651w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Weapon Pickups:<\/h2>\n\n\n\n<p>Once I had the gun mesh positioned correctly I made a Blueprint version for the item pickup that will appear in the game world.  In addition I added some megascan assets from Quixel Bridge to add a little flair to the new level area and to highlight the spot where the weapon will be available for pickup.  <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"733\" src=\"https:\/\/wildtechgames.com\/wp-content\/uploads\/2024\/03\/image-10-1024x733.png\" alt=\"\" class=\"wp-image-203\" srcset=\"https:\/\/wildtechgames.com\/wp-content\/uploads\/2024\/03\/image-10-1024x733.png 1024w, https:\/\/wildtechgames.com\/wp-content\/uploads\/2024\/03\/image-10-300x215.png 300w, https:\/\/wildtechgames.com\/wp-content\/uploads\/2024\/03\/image-10-768x550.png 768w, https:\/\/wildtechgames.com\/wp-content\/uploads\/2024\/03\/image-10-1536x1100.png 1536w, https:\/\/wildtechgames.com\/wp-content\/uploads\/2024\/03\/image-10.png 1676w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Blueprint Logic:<\/h2>\n\n\n\n<p>The fun part comes with the Blueprints on the event graph of the player character. I already had the logic for the torch pickup, so now had to introduce the logic for the weapon pickup. This required moving some things around to accommodate for more than 1 type of item the player might encounter.  I&#8217;m sure there are better ways of setting up these functions and logic (and I have many ideas of making this more reusable while following along this part of the tutorial), but for now I&#8217;m following the tutorial&#8217;s example.<br><br>So now the character blueprint event graph will check to see what item the character has come into contact with and will pick up the appropriate one using the &#8220;E&#8221; (interact) keybinding.  The result is the weapon pickup now appears in the players hand and the item pickup in the world disappears appropriately.  <br><br>Also worth noting, I know my event graph is messy.  I need to set some good habits on organizing my blueprints.  Unfortunately the tutorial doesn&#8217;t address proper event graph habits, but I&#8217;ve seen other videos with some good tips and habits about it.  <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"762\" src=\"https:\/\/wildtechgames.com\/wp-content\/uploads\/2024\/03\/image-11-1024x762.png\" alt=\"\" class=\"wp-image-205\" srcset=\"https:\/\/wildtechgames.com\/wp-content\/uploads\/2024\/03\/image-11-1024x762.png 1024w, https:\/\/wildtechgames.com\/wp-content\/uploads\/2024\/03\/image-11-300x223.png 300w, https:\/\/wildtechgames.com\/wp-content\/uploads\/2024\/03\/image-11-768x572.png 768w, https:\/\/wildtechgames.com\/wp-content\/uploads\/2024\/03\/image-11-1536x1143.png 1536w, https:\/\/wildtechgames.com\/wp-content\/uploads\/2024\/03\/image-11.png 1665w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion:<\/h2>\n\n\n\n<p>In the grand scheme of things I really haven&#8217;t done much with blueprints throughout this entire tutorial.  I&#8217;m looking forward to diving deeper into creating reusable collections of functions and systems to use when I being making my own.  I&#8217;ve read about the call and respond approach and a few others that I&#8217;ll learn about in the future.  <\/p>\n\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-4-3 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"My Unreal Engine Learning Journey \u2013 Day 32 \u2013 Weapons, Weapon Pickups, and Blueprint Logic\" width=\"640\" height=\"480\" src=\"https:\/\/www.youtube.com\/embed\/1lzmKLiqYPg?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<p><br><br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction: Today I added a weapon, weapon pickup, and some logic for the game to know which item the player is attempting to pick up. Weapons: Although this is an Unreal Engine Third Person project, I was able to choose a generic gun from the Unreal Engine&#8217;s built-in First Person default assets profile and attached [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[1,8],"tags":[10,11,14,9],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/wildtechgames.com\/index.php?rest_route=\/wp\/v2\/posts\/199"}],"collection":[{"href":"https:\/\/wildtechgames.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wildtechgames.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wildtechgames.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wildtechgames.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=199"}],"version-history":[{"count":5,"href":"https:\/\/wildtechgames.com\/index.php?rest_route=\/wp\/v2\/posts\/199\/revisions"}],"predecessor-version":[{"id":208,"href":"https:\/\/wildtechgames.com\/index.php?rest_route=\/wp\/v2\/posts\/199\/revisions\/208"}],"wp:attachment":[{"href":"https:\/\/wildtechgames.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=199"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wildtechgames.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=199"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wildtechgames.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=199"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}