<?xml version="1.0" encoding="UTF-8" standalone="yes"?><oembed><version><![CDATA[1.0]]></version><provider_name><![CDATA[Andrew Fray]]></provider_name><provider_url><![CDATA[https://andrewfray.wordpress.com]]></provider_url><author_name><![CDATA[afray]]></author_name><author_url><![CDATA[https://andrewfray.wordpress.com/author/afray/]]></author_url><title><![CDATA[Adding a custom movement mode to Unreal&#8217;s CharacterMovementComponent via&nbsp;blueprints]]></title><type><![CDATA[link]]></type><html><![CDATA[<p>This isn&#8217;t a full tutorial, and I&#8217;m not an expert, but I noticed this knowledge wasn&#8217;t really collected together anywhere, so I&#8217;m putting something together here. Please shout if there&#8217;s any holes or mistakes.</p>
<p>The <a href="https://docs.unrealengine.com/en-us/Gameplay/Networking/CharacterMovementComponent">CharacterMovementComponent</a> that comes with the third-person starter kit has several movement modes you can switch between using the <a href="http://api.unrealengine.com/INT/BlueprintAPI/Pawn/Components/CharacterMovement/SetMovementMode/">Set Movement Mode</a> node. Walking, falling, swimming, and flying are all supported out-of-the-box, but there&#8217;s also a &#8220;Custom&#8221; option in the dropdown. How do you implement a new custom movement mode?</p>
<p>First, limitations: I&#8217;ve <strong>not </strong>found a way to make networkable custom movement modes via blueprint. I think I need to be reusing the input from Add Movement Input, but I&#8217;m not yet sure how. Without doing that, the server has no idea how to do your movement.</p>
<p>When you set a new movement mode, the OnMovementModeChanged event (which is undocumented??) gets fired:</p>
<p><img loading="lazy" data-attachment-id="618" data-permalink="https://andrewfray.wordpress.com/2018/11/08/adding-a-custom-movement-mode-to-unreals-charactermovementcomponent-via-blueprints/movementmodechanged/" data-orig-file="https://andrewfray.files.wordpress.com/2018/11/movementmodechanged.png" data-orig-size="289,200" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="movementmodechanged" data-image-description="" data-image-caption="" data-medium-file="https://andrewfray.files.wordpress.com/2018/11/movementmodechanged.png?w=289" data-large-file="https://andrewfray.files.wordpress.com/2018/11/movementmodechanged.png?w=289" class="alignnone size-full wp-image-618" src="https://andrewfray.files.wordpress.com/2018/11/movementmodechanged.png?w=289&#038;h=200" alt="movementmodechanged" width="289" height="200" srcset="https://andrewfray.files.wordpress.com/2018/11/movementmodechanged.png 289w, https://andrewfray.files.wordpress.com/2018/11/movementmodechanged.png?w=150&amp;h=104 150w" sizes="(max-width: 289px) 100vw, 289px" /></p>
<p>At this point you can toggle state or meshes, zero velocity, and other things you might want to do when entering and leaving your custom mode.</p>
<p>The (also undocumented) UpdateCustomMovement event will fire when you need to do movement:</p>
<p><img loading="lazy" data-attachment-id="619" data-permalink="https://andrewfray.wordpress.com/2018/11/08/adding-a-custom-movement-mode-to-unreals-charactermovementcomponent-via-blueprints/updatemovementmode/" data-orig-file="https://andrewfray.files.wordpress.com/2018/11/updatemovementmode.png" data-orig-size="272,108" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="updatemovementmode" data-image-description="" data-image-caption="" data-medium-file="https://andrewfray.files.wordpress.com/2018/11/updatemovementmode.png?w=272" data-large-file="https://andrewfray.files.wordpress.com/2018/11/updatemovementmode.png?w=272" class="alignnone size-full wp-image-619" src="https://andrewfray.files.wordpress.com/2018/11/updatemovementmode.png?w=272&#038;h=108" alt="updatemovementmode.PNG" width="272" height="108" srcset="https://andrewfray.files.wordpress.com/2018/11/updatemovementmode.png 272w, https://andrewfray.files.wordpress.com/2018/11/updatemovementmode.png?w=150&amp;h=60 150w" sizes="(max-width: 272px) 100vw, 272px" /></p>
<p>From here you can read your input axis and implement your behaviours. You can just use the delta and Set Actor Location, but there&#8217;s also the Calc Velocity node which can help implement friction and deceleration for you.</p>
<p>To return to normal movement again, I&#8217;ve found it&#8217;s safest to use Set Movement Mode to enter Falling, and let the component sort itself out, but ymmv there.</p>
<p>Hope someone finds this helpful.</p>
]]></html><thumbnail_url><![CDATA[https://andrewfray.files.wordpress.com/2018/11/movementmodechanged.png?fit=440%2C330]]></thumbnail_url><thumbnail_width><![CDATA[289]]></thumbnail_width><thumbnail_height><![CDATA[200]]></thumbnail_height></oembed>