{"id":3034,"date":"2020-08-19T10:18:20","date_gmt":"2020-08-19T01:18:20","guid":{"rendered":"https:\/\/blog.criware.com\/?p=3034"},"modified":"2020-08-19T10:18:20","modified_gmt":"2020-08-19T01:18:20","slug":"creating-interactive-footsteps-in-ue4-with-adx2","status":"publish","type":"post","link":"https:\/\/blog.criware.com\/index.php\/2020\/08\/19\/creating-interactive-footsteps-in-ue4-with-adx2\/","title":{"rendered":"Creating Interactive Footsteps in UE4 with ADX2"},"content":{"rendered":"<h2 style=\"font-size: 150%; font-weight: bold; margin-top: 40px;\">Introduction<\/h2>\n<p>\nFootsteps are a staple part of game audio. Whether just simple noisy blips or complex interactive systems, these sounds can ground a player in a game. In many of these games, character movement is the most persistent form of interaction the player has with the game world. This fact makes it an important system to get right, so let\u2019s have a look at tackling this topic.\n<\/p>\n<p>\nIn this blog, we will create a dynamic system that will play relative to the character\u2019s movement speed and reflect changes in surface interaction. The result will mean sauntering across metal should sound very different from running across wood.\n<\/p>\n<div style=\"max-width: 800px; margin: 0 auto; margin-bottom: 20px;\">\n<div style=\"width: 800px;\" class=\"wp-video\"><video class=\"wp-video-shortcode\" id=\"video-3034-1\" width=\"800\" height=\"450\" preload=\"metadata\" controls=\"controls\"><source type=\"video\/mp4\" src=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/2020_08_Footsteps.mp4?_=1\" \/><a href=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/2020_08_Footsteps.mp4\">https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/2020_08_Footsteps.mp4<\/a><\/video><\/div>\n<\/div>\n<p><\/p>\n<div style=\"max-width: 800px; margin: 0 auto; margin-bottom: 20px; text-align:center;\"><a style=\"display: inline-block; border: 1px solid #ccc; padding: 20px;\" href=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/2020_08_Footsteps.zip\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1813\" src=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2018\/06\/zip.png\" alt=\"zip\" width=\"80\" height=\"78\" style=\"\n    display: block;\n    margin: 0 auto;\n\">2020_08_Footsteps.zip<\/a><\/div>\n<p><em>This project was created using CRI Atom Craft Ver.3.43.09 and UE4.24.3<\/em><\/p>\n<h2 style=\"font-size: 150%; font-weight: bold; margin-top: 40px;\">Atom Craft<\/h2>\n<p>\nWalking is made up of two distinct impacts, a stomp of the heel, and a slap of the forefoot\/toes. Generally speaking, the faster a person moves, the shorter the time between these two impacts. We can recreate this process in Atom Craft by using separate Cues for each and sequencing them in our game engine. This approach has the added benefit of allowing for more random variation. To create our system, we will need to create:<\/p>\n<ul>\n<li>A Selector and name it \u201cFootstep_Surface\u201d\n<ul>\n<li>Create 3 Selector Labels named\n<ul>\n<li>\u201cGravel\u201d<\/li>\n<li>\u201cMetal\u201d<\/li>\n<li>\u201cWood\u201d<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<li>A <b>Random No Repeat Cue<\/b> for each heel and toe surface type\n<ul>\n<li>Named appropriately (\u201cGravel_Heel,\u201d \u201cGravel_Toe,\u201d \u201cMetal_Heel\u201d etc.)<\/li>\n<\/ul>\n<\/li>\n<li>Two <b>Polyphonic Cues<\/b>, named \u201cFootstep_Heel\u201d and \u201cFootstep_Toe\u201d\n<ul>\n<li>Link all <b>Random No Repeat<\/b> Cues to their respective <b>Polyphonic Cue<\/b>s<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/1.png\" alt=\"1\" width=\"1072\" height=\"404\" class=\"alignnone size-full wp-image-3042\" srcset=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/1.png 1072w, https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/1-300x113.png 300w, https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/1-768x289.png 768w, https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/1-1024x386.png 1024w\" sizes=\"auto, (max-width: 1072px) 100vw, 1072px\" \/><\/p>\n<p>\nTo play our heel-toe components in UE4, we will trigger them separately, and control the offset in the game engine. However, to test the heel-toe components as one footstep in Atom Craft, we can create a temporary Cue and manually offset them in the Timeline.  <\/p>\n<p>\n[Note] To avoid clutter in our UE4 project, we can place the heel-toe components in a Private Cue Folder.\n<\/p>\n<h2 style=\"font-size: 150%; font-weight: bold; margin-top: 40px;\">UE4 <\/h2>\n<p>\nTo implement our audio, we can use the Third Person Blueprints template that UE4 provides. As usual, the documentation is the best place to start if you need help getting the CRIWARE SDK integrated, and the CueSheet Binary imported.<\/p>\n<p>\nTo determine what surface our character is walking on, we can make use of UE4\u2019s <b>Physics Material<\/b> feature. To set this up, we first need to select Edit \u2192 Project Settings \u2192 Engine \u2192 Physics and scroll to the bottom.\n<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/2.png\" alt=\"2\" width=\"772\" height=\"150\" class=\"alignnone size-full wp-image-3043\" srcset=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/2.png 772w, https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/2-300x58.png 300w, https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/2-768x149.png 768w\" sizes=\"auto, (max-width: 772px) 100vw, 772px\" \/><\/p>\n<p>\nUnder Physical Surface, we can create surface types for each the Selector Labels we defined in Atom Craft: \u201cGravel,\u201d \u201cMetal,\u201d and \u201cWood.\u201d Next, in the Content Browser, right-click, and select Physics \u2192 Physics Material. Then, create a new <b>Physics Material<\/b> for each of the above Physical Surfaces, and name them accordingly.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/3.png\" alt=\"3\" width=\"602\" height=\"233\" class=\"alignnone size-full wp-image-3044\" srcset=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/3.png 602w, https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/3-300x116.png 300w\" sizes=\"auto, (max-width: 602px) 100vw, 602px\" \/><\/p>\n<p>\nOpen each <b>Physics Material<\/b> and under Physical Properties, set the Surface Type to match to the Physical Surface created in the Project Settings menu.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/4.png\" alt=\"4\" width=\"714\" height=\"346\" class=\"alignnone size-full wp-image-3045\" srcset=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/4.png 714w, https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/4-300x145.png 300w\" sizes=\"auto, (max-width: 714px) 100vw, 714px\" \/><\/p>\n<p>\nNext, we can create some Planes to test each of our surfaces. To assign our Physics Materials, we can drag from the Content Browser onto Phy Material Override under the Collision heading in the details panel while the appropriate Actor is selected.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/5.png\" alt=\"5\" width=\"496\" height=\"427\" class=\"alignnone size-full wp-image-3046\" srcset=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/5.png 496w, https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/5-300x258.png 300w\" sizes=\"auto, (max-width: 496px) 100vw, 496px\" \/><\/p>\n<p>\nWe can control the heel-toe playback via different methods. One of the simplest is to scrub through the Timeline of our walking Animation manually, and right-click on the Notifies timeline \u2192 Add Notify \u2192 PlayAtomCue when the heel lands, then again when the toes land. Let\u2019s go ahead and do this for both the ThirdPersonRun and ThirdPersonWalk animations, which can be found under Content \u2192 Mannequin \u2192 Animations. A <b>Blend Space<\/b> controls the transition between idle, walking, and running states. If sounds are triggering erroneously, ensure that Notify Trigger Mode is set to \u201cHighest Weighted Animation\u201d in the Asset Details panel on the <b>Blend Space<\/b> asset.\n<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/6.png\" alt=\"6\" width=\"993\" height=\"346\" class=\"alignnone size-full wp-image-3047\" srcset=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/6.png 993w, https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/6-300x105.png 300w, https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/6-768x268.png 768w\" sizes=\"auto, (max-width: 993px) 100vw, 993px\" \/><\/p>\n<p>\nWe also need to ensure the correct sound plays for each. To do this, we need to highlight each Anim Notify and select the right sound from the dropdown in the Details panel.\n<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/7.png\" alt=\"7\" width=\"498\" height=\"412\" class=\"alignnone size-full wp-image-3048\" srcset=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/7.png 498w, https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/7-300x248.png 300w\" sizes=\"auto, (max-width: 498px) 100vw, 498px\" \/><\/p>\n<p>\nPlaying the game now should subtly reflect the difference in movement speed. However, we need one last piece of code to control the playback relative to surface type. Let\u2019s open the ThirdPersonCharacter Blueprint and navigate to the \u201cMovement input\u201d section of the Blueprint. To check the surface below the character, we can do a simple LineTraceByChannel directly down from the character.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/8.png\" alt=\"8\" width=\"1313\" height=\"493\" class=\"alignnone size-full wp-image-3049\" srcset=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/8.png 1313w, https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/8-300x113.png 300w, https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/8-768x288.png 768w, https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/8-1024x384.png 1024w\" sizes=\"auto, (max-width: 1313px) 100vw, 1313px\" \/><\/p>\n<p>\nThe above code is run just after adding the player\u2019s input to the character\u2019s Add Movement Input. This code will GetActorLocation from the character (self) to determine the Start point and calculate a line straight down to get the End point.\n<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/9.png\" alt=\"9\" width=\"1168\" height=\"461\" class=\"alignnone size-full wp-image-3050\" srcset=\"https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/9.png 1168w, https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/9-300x118.png 300w, https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/9-768x303.png 768w, https:\/\/blog.criware.com\/wp-content\/uploads\/2020\/08\/9-1024x404.png 1024w\" sizes=\"auto, (max-width: 1168px) 100vw, 1168px\" \/><\/p>\n<p>\nWe can finally Get Surface Type from the Out Hit of the line trace and use Select to output the correct String based on what was hit. Since we named our Physical Surfaces in UE4 the same as our Selector Labels in Atom Craft, we can type strings that match the inputs. We can also determine what sound should play if a surface doesn\u2019t have a Physics Material attached by setting a Selector Label for the Default input.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction Footsteps are a staple part of game audio. Whether just simple noisy blips or complex interactive systems, these sounds<\/p>\n","protected":false},"author":2,"featured_media":3053,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"colormag_page_container_layout":"default_layout","colormag_page_sidebar_layout":"default_layout","footnotes":""},"categories":[5,7],"tags":[],"class_list":["post-3034","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-adx","category-tutorials"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/posts\/3034","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/comments?post=3034"}],"version-history":[{"count":9,"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/posts\/3034\/revisions"}],"predecessor-version":[{"id":3055,"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/posts\/3034\/revisions\/3055"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/media\/3053"}],"wp:attachment":[{"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/media?parent=3034"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/categories?post=3034"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.criware.com\/index.php\/wp-json\/wp\/v2\/tags?post=3034"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}