{"id":2638,"date":"2026-10-04T15:17:28","date_gmt":"2026-10-04T07:17:28","guid":{"rendered":"https:\/\/www.xinot.icu\/?p=2638"},"modified":"2026-10-04T17:37:52","modified_gmt":"2026-10-04T09:37:52","slug":"%e4%bb%8e%e6%8e%a5%e6%94%b6%e8%be%93%e5%85%a5%e5%88%b0%e5%ae%9e%e9%99%85%e8%ae%a9character%e7%a7%bb%e5%8a%a8%e7%9a%84%e5%a4%a7%e8%87%b4%e9%93%be%e8%b7%af","status":"publish","type":"post","link":"https:\/\/www.xinot.icu\/?p=2638","title":{"rendered":"\u4ece\u63a5\u6536\u8f93\u5165\u5230\u5b9e\u9645\u8ba9Character\u79fb\u52a8\u7684\u5927\u81f4\u94fe\u8def"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"2638\" class=\"elementor elementor-2638\" data-elementor-settings=\"[]\">\n\t\t\t\t\t\t\t<div class=\"elementor-section-wrap\">\n\t\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-ffe1a1f elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"ffe1a1f\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-deb6bb4\" data-id=\"deb6bb4\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-c368885 elementor-widget elementor-widget-heading\" data-id=\"c368885\" data-element_type=\"widget\" data-widget_type=\"heading.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<h2 class=\"elementor-heading-title elementor-size-default\">\u4ece\u63a5\u6536\u8f93\u5165\u5230\u5b9e\u9645\u8ba9Character\u79fb\u52a8\u7684\u5927\u81f4\u94fe\u8def<\/h2>\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-476d090 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"476d090\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-3de1357d\" data-id=\"3de1357d\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t\t\t<div class=\"elementor-element elementor-element-19b6513f elementor-widget elementor-widget-text-editor\" data-id=\"19b6513f\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<!-- wp:heading {\"level\":3} -->\n<h3 class=\"wp-block-heading\">\u76ee\u5f55<\/h3>\n<!-- \/wp:heading -->\n\n<!-- wp:html -->\n<div style=\"width:10%;border-top:2.4px solid #6ec1e4;margin:-13px 0 22px\"><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:html -->\n<style>\n.xn-toc ul{list-style:none;margin:0;padding:0}\n.xn-toc>ul>li{margin:0 0 6px}\n.xn-toc>ul>li>a{font-weight:700;color:#4b4f58}\n.xn-toc li ul{margin:4px 0 10px 2px;padding-left:16px;border-left:2px solid #d6ecf5}\n.xn-toc li li{margin:3px 0;font-size:15px}\n.xn-toc li li a{color:#777}\n.xn-toc a{text-decoration:none;transition:color .15s}\n.xn-toc a:hover{color:#6ec1e4}\n<\/style>\n<nav class=\"xn-toc\"><ul>\n<li><a href=\"#toc-1\">\u524d\u8a00<\/a><\/li>\n<li><a href=\"#toc-2\">\u589e\u5f3a\u8f93\u5165 Enhanced Input<\/a><ul>\n<li><a href=\"#toc-3\">FVector \u662f\u5565<\/a><\/li>\n<li><a href=\"#toc-4\">\u8f93\u5165\u52a8\u4f5c Input Action<\/a><\/li>\n<li><a href=\"#toc-5\">Modifier\u3001Trigger \u4e0e\u89e6\u53d1\u72b6\u6001<\/a><\/li>\n<li><a href=\"#toc-6\">\u8f93\u5165\u6620\u5c04\u4e0a\u4e0b\u6587 Input Mapping Context<\/a><\/li>\n<li><a href=\"#toc-7\">\u8d44\u4ea7\u80cc\u540e\u7684\u7c7b<\/a><\/li>\n<li><a href=\"#toc-8\">Subsystem \u5b50\u7cfb\u7edf<\/a><\/li>\n<li><a href=\"#toc-9\">\u542f\u52a8\u5230\u56de\u8c03\u7684\u68b3\u7406<\/a><\/li>\n<\/ul><\/li>\n<li><a href=\"#toc-10\">\u89d2\u8272\u79fb\u52a8<\/a><ul>\n<li><a href=\"#toc-11\">Pawn \u4e0e Character<\/a><\/li>\n<li><a href=\"#toc-12\">Pawn \u5c42\u53ea\u8d1f\u8d23\u6512\u8f93\u5165<\/a><\/li>\n<li><a href=\"#toc-13\">\u8f93\u5165\u53d8\u6210\u52a0\u901f\u5ea6<\/a><\/li>\n<li><a href=\"#toc-14\">\u52a0\u901f\u5ea6\u53d8\u6210\u901f\u5ea6<\/a><\/li>\n<li><a href=\"#toc-15\">StartNewPhysics \u4e0e PhysWalking<\/a><\/li>\n<li><a href=\"#toc-16\">MoveAlongFloor \u5230\u5b9e\u9645\u79fb\u52a8<\/a><\/li>\n<li><a href=\"#toc-17\">\u6574\u6761\u94fe\u8def<\/a><\/li>\n<\/ul><\/li>\n<li><a href=\"#toc-18\">\u4e00\u4e9b\u5c0f\u7591\u8651<\/a><\/li>\n<\/ul><\/nav>\n<!-- \/wp:html -->\n\n<!-- wp:spacer {\"height\":\"27px\"} -->\n<div style=\"height:27px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n<!-- \/wp:spacer -->\n\n<!-- wp:heading {\"level\":3} -->\n<h3 class=\"wp-block-heading\" id=\"toc-1\">\u524d\u8a00<\/h3>\n<!-- \/wp:heading -->\n\n<!-- wp:html -->\n<div style=\"width:10%;border-top:2.4px solid #6ec1e4;margin:-13px 0 22px\"><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>\u7ed3\u675f\u4e86UE\u57fa\u7840\u7684\u5b66\u4e60\uff0c\u5f00\u59cb\u4e0b\u4e00\u6b65\u4e86\uff1b<br>\u7efc\u5408\u54a8\u8be2\u9879\u76ee\u7ec4\u5185\u9876\u5c16\u7a0b\u5e8f\u4ee5\u53caAI\u540e\uff0c\u6574\u7406\u4e86\u4efd\u8def\u7ebf\uff0c\u63a5\u4e0b\u6765\u5927\u6982\u6309 \u8f93\u5165 &gt; \u89d2\u8272\u79fb\u52a8 &gt; \u52a8\u753b &gt; \u76f8\u673a &gt; \u6574\u5408 \u8fd9\u4e2a\u987a\u5e8f\u5f80\u4e0b\u8d70\u3002<br>\u8fd9\u7bc7\u662f\u524d\u4e24\u7ad9\u7684\u7b14\u8bb0\u6574\u7406\uff0c\u60f3\u641e\u6e05\u695a\u7684\u4e8b\u60c5\u5c31\u4e00\u4ef6\uff1a\u4ece\u6309\u4e0b\u6309\u952e\uff0c\u5230\u89d2\u8272\u5b9e\u9645\u52a8\u8d77\u6765\uff0c\u4e2d\u95f4\u7ecf\u8fc7\u4e86\u54ea\u4e9b\u4e1c\u897f\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>\u8bfb\u7684\u662f 5.6.1 \u7684\u6e90\u7801\u7248\u5f15\u64ce\uff0c\u5de5\u7a0b\u662f\u7b2c\u4e09\u4eba\u79f0\u6a21\u677f\u6539\u7684\uff0c\u53ea\u8d70\u4e86\u4e3b\u5e72\uff0c\u5f88\u591a\u5206\u652f\u662f\u8df3\u8fc7\u7684\uff0c\u540e\u9762\u4f1a\u8bf4\u3002<br>\u51e0\u4efd\u4e3b\u8981\u53c2\u8003\u7684\u5b98\u65b9\u6587\u6863\uff1a<br><a href=\"https:\/\/dev.epicgames.com\/documentation\/unreal-engine\/enhanced-input-in-unreal-engine?lang=zh-CN\"><em><span style=\"text-decoration: underline;\">\u589e\u5f3a\u8f93\u5165<\/span><\/em><\/a>\u3001<a href=\"https:\/\/dev.epicgames.com\/documentation\/unreal-engine\/movement-components-in-unreal-engine?application_version=5.4&amp;lang=zh-CN\"><em><span style=\"text-decoration: underline;\">\u79fb\u52a8\u7ec4\u4ef6<\/span><\/em><\/a>\u3001<a href=\"https:\/\/dev.epicgames.com\/documentation\/unreal-engine\/characters-in-unreal-engine?application_version=5.4\"><em><span style=\"text-decoration: underline;\">Character<\/span><\/em><\/a>\u3001<a href=\"https:\/\/dev.epicgames.com\/documentation\/unreal-engine\/setting-up-character-movement?application_version=5.5\"><em><span style=\"text-decoration: underline;\">\u8bbe\u7f6e\u89d2\u8272\u52a8\u4f5c<\/span><\/em><\/a>\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:spacer {\"height\":\"27px\"} -->\n<div style=\"height:27px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n<!-- \/wp:spacer -->\n\n<!-- wp:heading {\"level\":3} -->\n<h3 class=\"wp-block-heading\" id=\"toc-2\">\u589e\u5f3a\u8f93\u5165 Enhanced Input<\/h3>\n<!-- \/wp:heading -->\n\n<!-- wp:html -->\n<div style=\"width:10%;border-top:2.4px solid #6ec1e4;margin:-13px 0 22px\"><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:heading {\"level\":4} -->\n<h4 class=\"wp-block-heading\" id=\"toc-3\">FVector \u662f\u5565<\/h4>\n<!-- \/wp:heading -->\n\n<!-- wp:paragraph -->\n<p>\u5148\u63d0\u8fd9\u4e2a\uff0c\u662f\u56e0\u4e3a\u540e\u9762\u4f1a\u770b\u5230\u540c\u4e00\u4e2a FVector \u5728\u94fe\u8def\u4e0a\u4e0d\u505c\u6362\u8eab\u4efd\u3002<br>\u7b80\u5355\u6765\u8bf4\u5c31\u662f\u5305\u542b\u4e09\u4e2a\u6d6e\u70b9\u6570\u7684struct\uff08\u7ed3\u6784\u4f53\uff09\uff0c\u5305\u542bxyz\uff0c\u672c\u8eab\u6ca1\u6709\u4efb\u4f55\u610f\u4e49\uff1b<br>\u5b83\u7684\u8868\u73b0\u53d6\u51b3\u4e8e\u88ab\u4f20\u7ed9\u4e86\u8c01\uff0c\u6bd4\u5982\u8bf4\u4f4d\u7f6e\u3001\u65b9\u5411\u3001\u901f\u5ea6\u3001\u529b\u7b49\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>\u987a\u5e26\u4e00\u63d0\uff0cUE5 \u91cc\u8fd9\u4e09\u4e2a\u5206\u91cf\u662f double \u4e0d\u662f float\uff0cMathFwd.h \u91cc\u5199\u7684\u662f using FVector = UE::Math::TVector&lt;double&gt;;<br>UE5 \u4e3a\u4e86\u652f\u6301\u5927\u4e16\u754c\u5750\u6807\uff0c\u628a\u7cbe\u5ea6\u6574\u4f53\u63d0\u4e0a\u53bb\u4e86\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:heading {\"level\":4} -->\n<h4 class=\"wp-block-heading\" id=\"toc-4\">\u8f93\u5165\u52a8\u4f5c Input Action<\/h4>\n<!-- \/wp:heading -->\n\n<!-- wp:paragraph -->\n<p>\u672c\u8d28\u662f\u6570\u636e\u8d44\u4ea7\uff08\u914d\u7f6e\uff09\uff0c\u53ef\u4ee5\u7406\u89e3\u4e3aIA\u662f&#8221;\u73a9\u5bb6\u610f\u56fe&#8221;\uff1b<br>\u6bd4\u5982\u8bf4IA_Jump\uff0c\u662f\u8df3\u8dc3\uff0c\u4f46\u662f\u53ef\u4ee5\u901a\u8fc7\u591a\u79cd\u6309\u952e\u89e6\u53d1\uff0c\u6bd4\u5982\u8bf4\u952e\u76d8\u7a7a\u683c\u3001\u624b\u67c4A\u952e\u7b49\uff1b<br>\u901a\u8fc7IA\uff0c\u53ef\u4ee5\u628a\u300c\u52a8\u4f5c\u300d\u4e0e\u300c\u6309\u952e\u300d\u89e3\u8026\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>IA \u8eab\u4e0a\u6709\u4e2a\u503c\u7c7b\u578b EInputActionValueType\uff0c\u51b3\u5b9a\u8fd9\u4e2a\u610f\u56fe\u643a\u5e26\u4ec0\u4e48\u6570\u636e\uff0c\u4e00\u5171\u56db\u79cd\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:list -->\n<ul class=\"wp-block-list\"><!-- wp:list-item -->\n<li>Boolean \u662f\u5f00\u5173\uff0c\u53ea\u6709\u6309\u4e0b\u548c\u677e\u5f00\uff0c\u8df3\u8dc3\u3001\u8e72\u4e0b\u3001\u51b2\u523a\u8fd9\u7c7b\u64cd\u4f5c\u7528\u5b83\u3002<\/li>\n<!-- \/wp:list-item -->\n\n<!-- wp:list-item -->\n<li>Axis1D \u662f\u4e00\u4e2a float\uff0c\u9002\u5408\u6cb9\u95e8\u5927\u5c0f\u8fd9\u79cd\u5355\u8f74\u6a21\u62df\u91cf\u3002<\/li>\n<!-- \/wp:list-item -->\n\n<!-- wp:list-item -->\n<li>Axis2D \u662f\u4e00\u4e2a Vector2D\uff0c\u89d2\u8272\u79fb\u52a8\u7528\u7684\u5c31\u662f\u5b83\uff0cWASD \u6216\u8005\u5de6\u6447\u6746\uff0cX \u548c Y \u5206\u522b\u662f\u5de6\u53f3\u548c\u524d\u540e\u3002<\/li>\n<!-- \/wp:list-item -->\n\n<!-- wp:list-item -->\n<li>Axis3D \u662f\u4e00\u4e2a Vector\uff0c\u7528\u4e8e\u8fd0\u52a8\u63a7\u5236\u5668\u4f4d\u7f6e\u8fd9\u7c7b\u4e09\u7ef4\u8f93\u5165\uff0cVR \u548c\u98de\u884c\u4f1a\u7528\u5230\u3002<\/li>\n<!-- \/wp:list-item --><\/ul>\n<!-- \/wp:list -->\n\n<!-- wp:paragraph -->\n<p>\u6e90\u7801\u5728 Engine\\Plugins\\EnhancedInput\\Source\\EnhancedInput\\Public\\InputAction.h\uff0c\u53ef\u4ee5\u770b\u5230 UInputAction : UDataAsset\uff0cIA \u7684\u672c\u8d28\u5c31\u662f\u4e2a DataAsset\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:heading {\"level\":4} -->\n<h4 class=\"wp-block-heading\" id=\"toc-5\">Modifier\u3001Trigger \u4e0e\u89e6\u53d1\u72b6\u6001<\/h4>\n<!-- \/wp:heading -->\n\n<!-- wp:paragraph -->\n<p>\u6240\u6709\u7684IA\u90fd\u6709\u81ea\u5e26\u7684\u89e6\u53d1\u72b6\u6001\u5c5e\u6027\uff0c\u5b9a\u4e49\u5728 InputTriggers.h \u7684 ETriggerEvent \u91cc\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">enum class ETriggerEvent : uint8\n{\n    None        = (0x0)     UMETA(Hidden),\n    Triggered   = (1 &lt;&lt; 0), \/\/ ETriggerState (None -&gt; Triggered, Ongoing -&gt; Triggered, Triggered -&gt; Triggered)\n    Started     = (1 &lt;&lt; 1), \/\/ ETriggerState (None -&gt; Ongoing, None -&gt; Triggered)\n    Ongoing     = (1 &lt;&lt; 2), \/\/ ETriggerState (Ongoing -&gt; Ongoing)\n    Canceled    = (1 &lt;&lt; 3), \/\/ ETriggerState (Ongoing -&gt; None)\n    Completed   = (1 &lt;&lt; 4), \/\/ ETriggerState (Triggered -&gt; None)\n};<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:image {\"align\":\"center\"} -->\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.xinot.icu\/wp-content\/uploads\/2026\/10\/\u4ece\u63a5\u6536\u8f93\u5165\u5230\u5b9e\u9645\u8ba9Character\u79fb\u52a8\u7684\u5927\u81f4\u94fe\u8def_\u56fe1.png\" alt=\"\"\/><\/figure>\n<!-- \/wp:image -->\n\n<!-- wp:paragraph -->\n<p>\u53ef\u4ee5\u901a\u8fc7\u9009\u62e9\u63a5\u6536\u4e0d\u540c\u7684\u72b6\u6001\uff0c\u6765\u54cd\u5e94\u5bf9\u5e94\u7684\u4e8b\u4ef6\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:image {\"align\":\"center\"} -->\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.xinot.icu\/wp-content\/uploads\/2026\/10\/\u4ece\u63a5\u6536\u8f93\u5165\u5230\u5b9e\u9645\u8ba9Character\u79fb\u52a8\u7684\u5927\u81f4\u94fe\u8def_\u56fe2.png\" alt=\"\"\/><\/figure>\n<!-- \/wp:image -->\n\n<!-- wp:paragraph -->\n<p>\u800c Trigger \u51b3\u5b9a\u4e86 IA \u5982\u4f55\u8fdb\u5165\u4e0a\u8ff0\u8fd9\u4e9b\u72b6\u6001\u3002\u82e5\u914d\u7f6e\u4e3a None\uff0c\u9ed8\u8ba4\u6309\u4e0b\u540e\u7acb\u523b\u89e6\u53d1\uff0c\u5e76\u4e14\u6309\u4f4f\u671f\u95f4\u53ea\u8981\u503c\u4e0d\u4e3a\u96f6\uff0c\u6bcf\u4e00\u5e27\u90fd\u662f Triggered\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:image {\"align\":\"center\"} -->\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.xinot.icu\/wp-content\/uploads\/2026\/10\/\u4ece\u63a5\u6536\u8f93\u5165\u5230\u5b9e\u9645\u8ba9Character\u79fb\u52a8\u7684\u5927\u81f4\u94fe\u8def_\u56fe3.png\" alt=\"\"\/><\/figure>\n<!-- \/wp:image -->\n\n<!-- wp:paragraph -->\n<p>\u4ee5 Hold \u4e3e\u4e2a\u4f8b\u5b50\uff0cHold Time Threshold \u914d\u7f6e\u4e3a 1.0\uff0c\u8fd9\u4e2a IA \u7684\u89e6\u53d1\u72b6\u6001\u6d41\u8f6c\u662f\u8fd9\u6837\u7684\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:list -->\n<ul class=\"wp-block-list\"><!-- wp:list-item -->\n<li>t=0.0s\uff0c\u73a9\u5bb6\u6309\u4e0b\u7a7a\u683c\uff1aStarted\uff08\u5df2\u5f00\u59cb\uff09<\/li>\n<!-- \/wp:list-item -->\n\n<!-- wp:list-item -->\n<li>t=0.1s\uff0c\u6309\u952e\u4ecd\u88ab\u6309\u4f4f\uff1aOngoing\uff08\u8fdb\u884c\u4e2d\uff09<\/li>\n<!-- \/wp:list-item -->\n\n<!-- wp:list-item -->\n<li>t=1s\uff0c\u5230\u8fbe 1 \u79d2\u9608\u503c\uff1aTriggered\uff08\u5df2\u89e6\u53d1\uff09\uff0c\u8df3\u8dc3\u52a8\u4f5c\u6b63\u5f0f\u6267\u884c<\/li>\n<!-- \/wp:list-item -->\n\n<!-- wp:list-item -->\n<li>t=1.5s\uff0c\u73a9\u5bb6\u677e\u5f00\u7a7a\u683c\uff1aCompleted\uff08\u5df2\u5b8c\u6210\uff09<\/li>\n<!-- \/wp:list-item --><\/ul>\n<!-- \/wp:list -->\n\n<!-- wp:paragraph -->\n<p>\u5982\u679c\u6ca1\u5230 1 \u79d2\u5c31\u677e\u624b\uff0c\u90a3\u5c31\u662f Canceled\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>\u5728 Trigger \u4e4b\u524d\u5176\u5b9e\u8fd8\u6709\u4e00\u9053\u5de5\u5e8f\uff0c\u5c31\u662f\u4fee\u9970\u5668 Modifier\u3002\u5b83\u4f1a\u5148\u4fee\u6539\u786c\u4ef6\u8bbe\u5907\u7684\u539f\u59cb\u8f93\u5165\u4fe1\u53f7\uff0c\u518d\u4f20\u7ed9 Trigger\u3002\u7ecf\u5e38\u7528\u5230\u7684\u573a\u666f\u5305\u62ec\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:list -->\n<ul class=\"wp-block-list\"><!-- wp:list-item -->\n<li>\u8c03\u6574\u624b\u67c4\u6447\u6746\u6b7b\u533a\uff0c\u907f\u514d\u8bef\u89e6<\/li>\n<!-- \/wp:list-item -->\n\n<!-- wp:list-item -->\n<li>\u8c03\u6574\u8f93\u5165\u7075\u654f\u5ea6<\/li>\n<!-- \/wp:list-item -->\n\n<!-- wp:list-item -->\n<li>\u8f93\u5165\u53d6\u53cd\uff0c\u5b9e\u73b0\u89c6\u89d2\u4e0a\u4e0b\u7ffb\u8f6c<\/li>\n<!-- \/wp:list-item -->\n\n<!-- wp:list-item -->\n<li>\u671d\u5411\u8f6c\u6362\uff0c\u4f7f\u89d2\u8272\u79fb\u52a8\u65b9\u5411\u76f8\u5bf9\u4e8e\u76f8\u673a\u800c\u4e0d\u662f\u4e16\u754c\u5750\u6807\u8f74<\/li>\n<!-- \/wp:list-item --><\/ul>\n<!-- \/wp:list -->\n\n<!-- wp:paragraph -->\n<p>\u53ef\u9009\u7684\u4fee\u9970\u5668\u79cd\u7c7b\u4e5f\u5f88\u591a\uff0c\u540e\u7eed\u7528\u5230\u518d\u4e86\u89e3\u5427\uff08<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:heading {\"level\":4} -->\n<h4 class=\"wp-block-heading\" id=\"toc-6\">\u8f93\u5165\u6620\u5c04\u4e0a\u4e0b\u6587 Input Mapping Context<\/h4>\n<!-- \/wp:heading -->\n\n<!-- wp:paragraph -->\n<p>\u8d1f\u8d23\u6620\u5c04\u8fd9\u4e00\u4ef6\u4e8b\uff0c\u672c\u8d28\u662f\u591a\u4e2aIA\u4ee5\u53ca\u5bf9\u5e94\u6309\u952e\u7684\u96c6\u5408\uff0c\u7c7b\u4f3c\u4e00\u4e2a\u6309\u952e\u914d\u7f6e\u8868\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>\u5b98\u65b9\u6587\u6863\u7684\u8bf4\u6cd5\u662f\uff1a<br>\u8f93\u5165\u6620\u5c04\u4e0a\u4e0b\u6587\uff08Input Mapping Contexts\uff09 \u662f\u8f93\u5165\u52a8\u4f5c\u7684\u96c6\u5408\uff0c\u8868\u793a\u73a9\u5bb6\u53ef\u4ee5\u5904\u4e8e\u7684\u7279\u5b9a\u4e0a\u4e0b\u6587\u3002\u5b83\u4eec\u63cf\u8ff0\u4e86\u7ed9\u5b9a\u8f93\u5165\u52a8\u4f5c\u7684\u89e6\u53d1\u89c4\u5219\u3002\u6620\u5c04\u4e0a\u4e0b\u6587\u53ef\u4ee5\u52a8\u6001\u5730\u4e3a\u6bcf\u4e2a\u7528\u6237\u6dfb\u52a0\u3001\u79fb\u9664\u6216\u5b89\u6392\u4f18\u5148\u6b21\u5e8f\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>\u5c06\u591a\u4e2aIA\u96c6\u5408\u6210IMC\uff0c\u65b9\u4fbf\u89d2\u8272\u5728\u4e0d\u540c\u72b6\u6001\u4e0b\uff0c\u76f4\u63a5\u5207\u6362\u6216\u53e0\u52a0\u6574\u5957\u63a7\u5236\u65b9\u6848\uff0c\u800c\u4e0d\u7528\u9010\u4e2a\u91cd\u65b0\u6620\u5c04\u6309\u952e\u3002<br>\u6e90\u7801\u6ce8\u91ca\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">\/**\n* UInputMappingContext : A collection of key to action mappings for a specific input context\n*\/<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>IMC \u4e2d\u540c\u6837\u53ef\u4ee5\u7ed9 IA \u914d\u7f6e\u4fee\u9970\u5668\u548c\u89e6\u53d1\u5668\u3002<br>\u6211\u539f\u672c\u4ee5\u4e3a IMC \u91cc\u7684\u914d\u7f6e\u4f18\u5148\u7ea7\u9ad8\u4e8e IA\uff0cIA \u4e0a\u7684\u914d\u7f6e\u662f&#8221;\u5168\u5c40\u9ed8\u8ba4\u503c&#8221;\uff0cIMC \u91cc\u7684\u914d\u7f6e\u662f&#8221;\u9488\u5bf9\u7279\u5b9a\u6309\u952e\u7684\u5c40\u90e8\u8986\u76d6&#8221;\uff0cIMC \u4e2d\u6709\u914d\u7f6e\u5c31\u4f18\u5148\u6309 IMC \u7684\u6765\u3002<br>\u540e\u6765\u8bfb\u6e90\u7801\u53d1\u73b0\u4e0d\u662f\u8986\u76d6\uff0c\u662f\u53e0\u52a0\uff0cEnhancedActionKeyMapping.h \u91cc Modifiers \u4e0a\u65b9\u7684\u6ce8\u91ca\u5199\u5f97\u5f88\u660e\u786e\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">\/**\n* Modifiers applied to the raw key value.\n* These are applied sequentially in array order.\n* \n* Note: Modifiers defined in individual key mappings will be applied before those defined in the Input Action asset.\n* Modifiers will not override any that are defined on the Input Action asset, they will be combined together during evaluation.\n*\/<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>\u4e5f\u5c31\u662f\u8bf4\uff0cIMC \u91cc\u90a3\u6761\u6620\u5c04\u4e0a\u7684 Modifier \u5148\u6267\u884c\uff0cIA \u4e0a\u7684\u518d\u53e0\u5728\u5b83\u7684\u7ed3\u679c\u4e0a\u6267\u884c\u3002Trigger \u4e5f\u5206\u4e24\u5c42\uff1a\u5148\u7b97\u6620\u5c04\u4e0a\u7684\uff0c\u518d\u7b97 IA \u4e0a\u7684\u3002\u5982\u679c\u6620\u5c04\u4e0a\u914d\u8fc7 Trigger\uff0c\u6700\u7ec8\u72b6\u6001\u53d6\u4e24\u5c42\u91cc\u8f83\u4f4e\u7684\u90a3\u4e2a\uff08EnhancedPlayerInput.cpp\uff09\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">TriggerState = ActionData.TriggerStateTracker.EvaluateTriggers(this, ActionData.Triggers, ActionData.Value, NonDilatedDeltaTime);\nTriggerState = ActionData.TriggerStateTracker.GetMappingTriggerApplied() ? FMath::Min(TriggerState, PrevState) : TriggerState;<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>\u6240\u4ee5\u4e24\u8fb9\u90fd\u914d\u4e86 Trigger\uff0c\u5c31\u5f97\u4e24\u8fb9\u90fd\u901a\u8fc7\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>Description \u662f\u7ed9\u4eba\u770b\u7684\u5907\u6ce8\uff0c\u53ef\u4ee5\u8bf4\u662fIMC\u7684\u6ce8\u91ca\uff0c\u5bf9\u5e94\u6210\u5458 ContextDescription\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>Registration \u4e0b\u9762\u53ea\u6709\u4e00\u4e2a RegistrationTrackingMode\uff0c\u7ba1\u7684\u662f\u540c\u4e00\u4e2a IMC \u88ab\u591a\u6b21 AddMappingContext \u65f6\u600e\u4e48\u7b97\uff1a\u9ed8\u8ba4\u7684 Untracked \u4e0d\u8ba1\u6570\uff0c\u7b2c\u4e00\u6b21 Remove \u5c31\u76f4\u63a5\u79fb\u9664\uff1bCountRegistrations \u4f1a\u8ba1\u6570\uff0cAdd \u51e0\u6b21\u5c31\u5f97 Remove \u51e0\u6b21\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>\u73a9\u5bb6\u81ea\u5b9a\u4e49\u6309\u952e\u5219\u662f IA \u4e0a\u7684 PlayerMappableKeySettings\uff0c\u8fd9\u4e2a\u7b80\u5355\u4e86\u89e3\u4e0b\uff0c\u7528\u5230\u518d\u5b66\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:heading {\"level\":4} -->\n<h4 class=\"wp-block-heading\" id=\"toc-7\">\u8d44\u4ea7\u80cc\u540e\u7684\u7c7b<\/h4>\n<!-- \/wp:heading -->\n\n<!-- wp:paragraph -->\n<p>\u914d\u7f6e\u770b\u5b8c\u4e86\uff0c\u63a5\u7740\u7ffb\u7ffb\u6e90\u7801\uff0c\u770b\u770b\u8fd9\u51e0\u4e2a\u8d44\u4ea7\u80cc\u540e\u662f\u4ec0\u4e48\u3002<br>\u5148\u662f InputAction\uff0c\u8def\u5f84 \\Engine\\Plugins\\EnhancedInput\\Source\\EnhancedInput\\Public\\InputAction.h\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">UCLASS(MinimalAPI, BlueprintType)\nclass UInputAction : public UDataAsset<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>\u7ee7\u627f\u4e86 DataAsset\uff0cIA \u672c\u8d28\u5c31\u662f DataAsset\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>\u540c\u4e00\u4e2a\u6587\u4ef6\u91cc\u6709\u4e2a\u679a\u4e3e\uff0c\u51b3\u5b9a\u591a\u4e2a\u6309\u952e\u540c\u65f6\u6620\u5c04\u5230\u540c\u4e00\u4e2a IA \u65f6\u6700\u7ec8\u503c\u600e\u4e48\u7b97\uff0c\u53d6\u7edd\u5bf9\u503c\u6700\u5927\uff0c\u6216\u8005\u5168\u90e8\u76f8\u52a0\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">enum class EInputActionAccumulationBehavior : uint8\n{\n    \/** Take the value from the mapping with the highest Absolute Value. *\/\n    TakeHighestAbsoluteValue,\n\n    \/** Cumulatively adds the key values for each mapping. *\/\n    Cumulative,\n};<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>\u9ed8\u8ba4\u662f TakeHighestAbsoluteValue\uff1a\u7ed9 -0.3 \u548c 0.5\uff0c\u7ed3\u679c\u53d6 0.5\u3002Cumulative \u662f\u76f8\u52a0\uff1a-0.7 \u548c +0.75 \u5f97\u5230 0.05\u3002\u5f15\u64ce\u6ce8\u91ca\u91cc\u4e3e\u7684\u4f8b\u5b50\u6b63\u597d\u662f WASD\uff0c\u5982\u679c\u5e0c\u671b\u540c\u65f6\u6309 W \u548c S \u65f6\u4e92\u76f8\u62b5\u6d88\uff0c\u5c31\u8be5\u7528\u8fd9\u4e2a\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>\u7c7b\u6ce8\u91ca\u6700\u540e\u4e00\u884c\u503c\u5f97\u6ce8\u610f\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">* Note: These are instanced per player (via FInputActionInstance)<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>\u8fd0\u884c\u6e38\u620f\u65f6\uff0cUE \u4f1a\u4e3a\u6bcf\u4e2a\u73a9\u5bb6\u521b\u5efa\u4e00\u4e2a IA \u7684\u8fd0\u884c\u65f6\u5b9e\u4f8b\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:list -->\n<ul class=\"wp-block-list\"><!-- wp:list-item -->\n<li>UInputAction\uff1a\u662f\u4f60\u5728\u7f16\u8f91\u5668\u91cc\u521b\u5efa\u7684\u90a3\u4e2a\u8d44\u4ea7\uff08\u6bd4\u5982 IA_Move\uff09\uff0c\u5b83\u5b9a\u4e49\u4e86&#8221;\u8fd9\u662f\u4ec0\u4e48\u64cd\u4f5c&#8221;\uff08\u503c\u7c7b\u578b\u3001\u89e6\u53d1\u5668\u9ed8\u8ba4\u503c\u7b49\uff09\uff0c\u662f\u9759\u6001\u7684\u6a21\u677f\uff0c\u5b58\u653e\u5728\u78c1\u76d8\u4e0a\uff0c\u4f9b\u7f8e\u672f\/\u7b56\u5212\u914d\u7f6e\u3002<\/li>\n<!-- \/wp:list-item -->\n\n<!-- wp:list-item -->\n<li>FInputActionInstance\uff1a\u662f\u6e38\u620f\u8fd0\u884c\u65f6\uff0cUE \u4e3a\u8fd9\u4e2a\u8d44\u4ea7\u5728\u5177\u4f53\u73a9\u5bb6\u8eab\u4e0a\u521b\u5efa\u7684\u52a8\u6001\u5b9e\u4f8b\uff0c\u5b83\u8bb0\u5f55\u4e86&#8221;\u8fd9\u4e2a\u64cd\u4f5c\u5f53\u524d\u7684\u503c\u662f\u591a\u5c11&#8221;\u3001\u201c\u72b6\u6001\u662f Ongoing \u8fd8\u662f Completed\u201d\uff0c\u6d3b\u5728\u5185\u5b58\u4e2d\uff0c\u4f9b\u7a0b\u5e8f\u8fd0\u884c\u65f6\u8bfb\u5199\u3002<\/li>\n<!-- \/wp:list-item --><\/ul>\n<!-- \/wp:list -->\n\n<!-- wp:paragraph -->\n<p>\u8fd9\u662f\u4e00\u79cd\u5178\u578b\u7684&#8221;\u6570\u636e\u4e0e\u903b\u8f91\u5206\u79bb&#8221;\u7684\u8bbe\u8ba1\u6a21\u5f0f\u3002\u5b58\u5728\u591a\u4e2a\u73a9\u5bb6\u7684\u65f6\u5019\uff0c\u6bcf\u4e2a\u73a9\u5bb6\u7684\u5f53\u524d IA \u72b6\u6001\u90fd\u4e0d\u540c\uff0c\u4e3a\u6bcf\u4e2a\u73a9\u5bb6\u521b\u5efa\u81ea\u5df1\u72ec\u6709\u7684\u5b9e\u4f8b\uff0c\u5c31\u80fd\u907f\u514d\u6df7\u6dc6\u3002\u8fd9\u4e9b\u5b9e\u4f8b\u5b58\u5728 UEnhancedPlayerInput \u91cc\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">mutable TMap&lt;TObjectPtr&lt;const UInputAction&gt;, FInputActionInstance&gt; ActionInstanceData;<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>FInputActionInstance \u4e0a\u5219\u662f\u83b7\u53d6\u5f53\u524d IA \u72b6\u6001\u7684\u4e00\u5806\u65b9\u6cd5\uff0c\u4ee5\u53ca\u6dfb\u52a0\/\u79fb\u9664 Trigger \u7684\u65b9\u6cd5\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">ETriggerEvent GetTriggerEvent() const { return TriggerEvent; }\nUE_API FInputActionValue GetValue() const;\nfloat GetElapsedTime() const { return ElapsedProcessedTime; }\nfloat GetTriggeredTime() const { return ElapsedTriggeredTime; }\n\/\/ ...\nvoid AddInputTrigger(UInputTrigger* InputTrigger) { Triggers.Add(InputTrigger); }\nvoid RemoveInputTrigger(UInputTrigger* InputTrigger) { Triggers.Remove(InputTrigger); }<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>\u7136\u540e\u662f IMC\uff0c\u8def\u5f84 Engine\\Plugins\\EnhancedInput\\Source\\EnhancedInput\\Public\\InputMappingContext.h\uff0c\u540c\u6837\u7ee7\u627f\u81ea UDataAsset\uff0c\u672c\u8d28\u4e5f\u662f DA\u3002\u5b83\u6700\u91cd\u8981\u7684\u6210\u5458\u662f\u4e00\u4e2a\u6570\u7ec4\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">UPROPERTY(config, BlueprintReadOnly, EditAnywhere, Category = \"Mappings\")\nTArray&lt;FEnhancedActionKeyMapping&gt; Mappings;<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>\u4e5f\u5c31\u662f\u8bf4\uff0cIMC \u672c\u8d28\u662f EnhancedActionKeyMapping\uff08\u7531 Key \u548c IA \u7ec4\u6210\uff09\u7684\u6570\u7ec4\u3002\u53e6\u5916\u8fd8\u6709\u4e00\u5806\u4fee\u6539 IMC \u914d\u7f6e\u7684\u65b9\u6cd5\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">UFUNCTION(BlueprintCallable, Category = \"Mapping\")\nUE_API FEnhancedActionKeyMapping&amp; MapKey(const UInputAction* Action, FKey ToKey);\n\nUFUNCTION(BlueprintCallable, Category = \"Mapping\")\nUE_API void UnmapKey(const UInputAction* Action, FKey Key);\n\nUFUNCTION(BlueprintCallable, Category = \"Mapping\")\nUE_API void UnmapAllKeysFromAction(const UInputAction* Action);\n\nUFUNCTION(BlueprintCallable, Category = \"Mapping\")\nUE_API void UnmapAll();<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>\u4e3b\u8981\u7528\u4e8e\u73a9\u5bb6\u81ea\u5b9a\u4e49\u6309\u952e\uff0c\u6e90\u7801\u4e0a\u65b9\u7684 TODO \u6ce8\u91ca\u4e5f\u8bf4\u4e86\uff0c\u8fd9\u4e9b\u662f\u7ed9\u6309\u952e\u8bbe\u7f6e\u754c\u9762\u7528\u7684\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>IMC \u4e0d\u50cf IA \u90a3\u6837\u4f1a\u6309\u73a9\u5bb6\u521b\u5efa\u8fd0\u884c\u65f6\u5b9e\u4f8b\u3002\u540c\u6837\u90fd\u662f DataAsset\uff0c\u4e3a\u4ec0\u4e48 IA \u6709\u5b9e\u4f8b\u800c IMC \u6ca1\u6709\uff1f<br>\u56e0\u4e3a IA \u6709\u5927\u91cf\u8fd0\u884c\u65f6\u72b6\u6001\uff0c\u6bd4\u5982\u5f53\u524d Triggers \u7684\u72b6\u6001\u3001\u89e6\u53d1\u65f6\u95f4\u7b49\uff0c\u6bcf\u4e2a\u73a9\u5bb6\u9700\u8981\u72ec\u7acb\u4fdd\u5b58\uff1b\u800c IMC \u672c\u8d28\u662f\u914d\u7f6e\u6570\u7ec4\uff0c\u51e0\u4e4e\u6ca1\u6709\u8fd0\u884c\u65f6\u72b6\u6001\uff0c\u6240\u4ee5\u6ca1\u5fc5\u8981\u521b\u5efa\u5b9e\u4f8b\u3002\uff08\u6211\u7b14\u8bb0\u91cc\u539f\u6765\u5199\u7684\u7406\u7531\u662f\u300cIMC \u6ca1\u6709\u6784\u9020\u51fd\u6570\u300d\uff0c\u8fd9\u4e2a\u4e0d\u592a\u5bf9\uff0cUObject \u88ab\u5b9e\u4f8b\u5316\u65f6\u4e00\u5b9a\u4f1a\u6784\u9020\u3002\uff09<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>\u6700\u540e\u662f\u6570\u7ec4\u91cc\u7684\u5143\u7d20 EnhancedActionKeyMapping\uff0c\u8def\u5f84 Engine\\Plugins\\EnhancedInput\\Source\\EnhancedInput\\Public\\EnhancedActionKeyMapping.h\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">UPROPERTY(EditAnywhere, Instanced, BlueprintReadWrite, Category = \"Input\")\nTArray&lt;TObjectPtr&lt;UInputTrigger&gt;&gt; Triggers;\n\nUPROPERTY(EditAnywhere, Instanced, BlueprintReadWrite, Category = \"Input\")\nTArray&lt;TObjectPtr&lt;UInputModifier&gt;&gt; Modifiers;\n\nUPROPERTY(EditAnywhere, BlueprintReadWrite, Category = \"Input\")\nTObjectPtr&lt;const UInputAction&gt; Action = nullptr;\n\nUPROPERTY(EditAnywhere, BlueprintReadWrite, Category = \"Input\")\nFKey Key;<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>\u6620\u5c04\u91cc\u6700\u91cd\u8981\u7684\u5c31\u8fd9\u51e0\u4e2a\u6210\u5458\u3002\u4e00\u6761 Mapping \u53ef\u4ee5\u62e5\u6709\u81ea\u5df1\u7684 Trigger \u548c Modifier\uff0c\u524d\u9762\u8bf4\u7684&#8221;\u4e24\u5c42&#8221;\u5c31\u662f\u4ece\u8fd9\u513f\u6765\u7684\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>\u770b\u5230\u8fd9\u91cc\uff0c\u5927\u6982\u80fd\u611f\u89c9\u5230 UE \u7684\u4e00\u79cd\u60ef\u6027\u8bbe\u8ba1\uff1aAsset \u8d1f\u8d23&#8221;\u63cf\u8ff0\u6570\u636e&#8221;\uff0cSubsystem \/ Instance \u8d1f\u8d23&#8221;\u8fd0\u884c\u65f6\u7ba1\u7406&#8221;\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>\u90a3\u5f53\u540c\u4e00\u4e2a\u5ba2\u6237\u7aef\u540c\u65f6\u5b58\u5728\u4e24\u4e2a\u73a9\u5bb6\u64cd\u63a7\u89d2\u8272\uff0c\u4ed6\u4eec\u5171\u7528\u4e00\u5957 IMC\uff0c\u5176\u4e2d\u4e00\u4e2a\u73a9\u5bb6\u66f4\u6539\u4e86\u952e\u4f4d\uff0c\u8fd9\u65f6\u5019\u5982\u4f55\u907f\u514d\u6df7\u6dc6\u5462\uff1f\u8fd9\u5c31\u8981\u770b EnhancedInputSubsystems \u4e86\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:heading {\"level\":4} -->\n<h4 class=\"wp-block-heading\" id=\"toc-8\">Subsystem \u5b50\u7cfb\u7edf<\/h4>\n<!-- \/wp:heading -->\n\n<!-- wp:paragraph -->\n<p>\u6e90\u7801\u8def\u5f84\uff1aEngine\\Plugins\\EnhancedInput\\Source\\EnhancedInput\\Public\\EnhancedInputSubsystems.h<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">\/\/ Per local player input subsystem\nUCLASS(MinimalAPI)\nclass UEnhancedInputLocalPlayerSubsystem : public ULocalPlayerSubsystem, public IEnhancedInputSubsystemInterface<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>\u7ee7\u627f\u4e86LocalPlayer\u5b50\u7cfb\u7edf\u3002\u6dfb\u52a0\/\u79fb\u9664 IMC \u7684\u63a5\u53e3\u5c31\u5728\u5b83\u8eab\u4e0a\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">UE_API virtual void AddMappingContext(const UInputMappingContext* MappingContext, int32 Priority, const FModifyContextOptions&amp; Options = FModifyContextOptions()) override;\nUE_API virtual void RemoveMappingContext(const UInputMappingContext* MappingContext, const FModifyContextOptions&amp; Options = FModifyContextOptions()) override;<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>\u800c\u771f\u6b63\u63a5\u6536\u5e76\u5904\u7406\u73a9\u5bb6\u8f93\u5165\u7684\u5bf9\u8c61\u662f UEnhancedPlayerInput\uff0cSubsystem \u662f\u4ece LocalPlayer \u7684 PlayerController \u8eab\u4e0a\u628a\u5b83\u53d6\u51fa\u6765\u7684\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">UE_API virtual UEnhancedPlayerInput* GetPlayerInput() const override;<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>\u6240\u4ee5\uff0c\u5728\u5b98\u65b9\u793a\u4f8b\u91cc\uff0c\u7ed9\u89d2\u8272\u5b9e\u4f8b\u6dfb\u52a0IMC\u4e4b\u524d\uff0c\u4e2d\u95f4\u9694\u4e86\u4e00\u4e2aEnhancedInputLocalPlayerSubsystem\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:image {\"align\":\"center\"} -->\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.xinot.icu\/wp-content\/uploads\/2026\/10\/\u4ece\u63a5\u6536\u8f93\u5165\u5230\u5b9e\u9645\u8ba9Character\u79fb\u52a8\u7684\u5927\u81f4\u94fe\u8def_\u56fe4.png\" alt=\"\"\/><\/figure>\n<!-- \/wp:image -->\n\n<!-- wp:paragraph -->\n<p>5.6 \u7684\u7b2c\u4e09\u4eba\u79f0 C++ \u6a21\u677f\u91cc\uff0c\u8fd9\u4e00\u6b65\u653e\u5728\u4e86 PlayerController \u7684 SetupInputComponent()\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">void AMyDemoPlayerController::SetupInputComponent()\n{\n    Super::SetupInputComponent();\n\n    \/\/ only add IMCs for local player controllers\n    if (IsLocalPlayerController())\n    {\n        if (UEnhancedInputLocalPlayerSubsystem* Subsystem = \n            ULocalPlayer::GetSubsystem&lt;UEnhancedInputLocalPlayerSubsystem&gt;(GetLocalPlayer()))\n        {\n            for (UInputMappingContext* CurrentContext : DefaultMappingContexts)\n            {\n                Subsystem-&gt;AddMappingContext(CurrentContext, 0);\n            }\n            \/\/ ...\n        }\n    }\n}<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>\u4e5f\u5c31\u662f\u8bf4\uff0c\u5b9e\u9645\u63a7\u5236\u6bcf\u4e2aLocalPlayer\u7684\u662f\u8fd9\u4e2aSubsystem\uff0c\u5e76\u975eIMC\uff1b<br>\u800c\u8fd9\u4e2aSubsystem\u4f1a\u5728\u6e38\u620f\u8fd0\u884c\u671f\u95f4\u5b9e\u65f6\u6784\u5efa\uff0c\u6bcf\u4e2a\u73a9\u5bb6\u72ec\u7acb\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>\u53e6\u5916\uff0cEnhancedInputSubsystems \u91cc\u5176\u5b9e\u6709\u4e24\u4e2a\u7c7b\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:list -->\n<ul class=\"wp-block-list\"><!-- wp:list-item -->\n<li>UEnhancedInputLocalPlayerSubsystem\uff1a\u7528\u4e8e\u672c\u5730\u73a9\u5bb6\uff0c\u4e5f\u5c31\u662f\u6709 PlayerController \u7684\u90a3\u4e2a\u89d2\u8272\u3002<\/li>\n<!-- \/wp:list-item -->\n\n<!-- wp:list-item -->\n<li>UEnhancedInputWorldSubsystem\uff1a\u7528\u4e8e World \u91cc\u9762\u6ca1\u6709 PlayerController \u7684 Actor\uff0c\u6bd4\u65b9\u8bf4\u6309\u4e0b\u7279\u5b9a\u7ec4\u5408\u6309\u952e\u624d\u80fd\u89e3\u9501\u7684\u95e8\u3002\u8fd9\u4e2a\u4f8b\u5b50\u5c31\u662f\u5f15\u64ce\u6ce8\u91ca\u91cc\u7684\uff0c5.6 \u91cc\u8fd9\u4e2a\u7c7b\u8fd8\u6807\u7740 Experimental\u3002<\/li>\n<!-- \/wp:list-item --><\/ul>\n<!-- \/wp:list -->\n\n<!-- wp:heading {\"level\":4} -->\n<h4 class=\"wp-block-heading\" id=\"toc-9\">\u542f\u52a8\u5230\u56de\u8c03\u7684\u68b3\u7406<\/h4>\n<!-- \/wp:heading -->\n\n<!-- wp:paragraph -->\n<p>\u6700\u540e\u68b3\u7406\u4e00\u4e0b\u6e38\u620f\u5f00\u59cb\uff0c\u5230\u63a5\u6536\u5230\u8f93\u5165\u7684\u6574\u4e2a\u6d41\u7a0b\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:list {\"ordered\":true} -->\n<ol class=\"wp-block-list\"><!-- wp:list-item -->\n<li>\u6e38\u620f\u5f00\u59cb<\/li>\n<!-- \/wp:list-item -->\n\n<!-- wp:list-item -->\n<li>\u521b\u5efaLocalPlayer<\/li>\n<!-- \/wp:list-item -->\n\n<!-- wp:list-item -->\n<li>\u521b\u5efaEnhancedInputLocalPlayerSubsystem\uff0c\u7ed9\u5230\u5bf9\u5e94\u7684LocalPlayer<\/li>\n<!-- \/wp:list-item -->\n\n<!-- wp:list-item -->\n<li>\u89d2\u8272 BeginPlay\uff08C++ \u6a21\u677f\u91cc\u662f PlayerController \u7684 SetupInputComponent\uff09<\/li>\n<!-- \/wp:list-item -->\n\n<!-- wp:list-item -->\n<li>\u83b7\u53d6 EnhancedInputLocalPlayerSubsystem<\/li>\n<!-- \/wp:list-item -->\n\n<!-- wp:list-item -->\n<li>Add Mapping Context(IMC)<\/li>\n<!-- \/wp:list-item -->\n\n<!-- wp:list-item -->\n<li>Subsystem \u6839\u636e IMC \u6784\u5efa\u8f93\u5165\u6620\u5c04<\/li>\n<!-- \/wp:list-item -->\n\n<!-- wp:list-item -->\n<li>\u73a9\u5bb6\u6309\u952e<\/li>\n<!-- \/wp:list-item -->\n\n<!-- wp:list-item -->\n<li>\u89e6\u53d1 IA<\/li>\n<!-- \/wp:list-item -->\n\n<!-- wp:list-item -->\n<li>BindAction \u56de\u8c03<\/li>\n<!-- \/wp:list-item --><\/ol>\n<!-- \/wp:list -->\n\n<!-- wp:paragraph -->\n<p>\u5230 BindAction \u56de\u8c03\u8fd9\u4e00\u6b65\uff0c\u8f93\u5165\u5c31\u4ea4\u5230\u89d2\u8272\u624b\u91cc\u4e86\u3002C++ \u91cc\u7684\u7ed1\u5b9a\u5199\u5728 Character \u7684 SetupPlayerInputComponent \u91cc\uff0c\u4ee5\u6211\u81ea\u5df1\u7684Demo\u5de5\u7a0b\u4e3a\u4f8b\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">if (UEnhancedInputComponent* EIC = Cast&lt;UEnhancedInputComponent&gt;(PlayerInputComponent))\n{\n    EIC-&gt;BindAction(MoveAction, ETriggerEvent::Triggered, this, &amp;AGymCharacter::Move);\n    EIC-&gt;BindAction(JumpAction, ETriggerEvent::Started,   this, &amp;AGymCharacter::Jump);\n    EIC-&gt;BindAction(JumpAction, ETriggerEvent::Completed, this, &amp;AGymCharacter::StopJumping);\n}<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>Move \u7ed1\u7684\u662f Triggered\u3002IA_Move \u6ca1\u914d Trigger\uff0c\u6309\u4f4f\u5c31\u6bcf\u5e27 Triggered\uff0c\u6240\u4ee5 Move \u6bcf\u5e27\u90fd\u4f1a\u88ab\u8c03\uff1bJump \u662f\u6309\u4e0b\u5f00\u59cb\u3001\u677e\u5f00\u505c\u6b62\uff0c\u6240\u4ee5 Started \u548c Completed \u5404\u7ed1\u4e00\u6761\u3002\u524d\u9762\u90a3\u5806\u89e6\u53d1\u72b6\u6001\uff0c\u5230\u8fd9\u91cc\u5c31\u7528\u4e0a\u4e86\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:spacer {\"height\":\"27px\"} -->\n<div style=\"height:27px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n<!-- \/wp:spacer -->\n\n<!-- wp:heading {\"level\":3} -->\n<h3 class=\"wp-block-heading\" id=\"toc-10\">\u89d2\u8272\u79fb\u52a8<\/h3>\n<!-- \/wp:heading -->\n\n<!-- wp:html -->\n<div style=\"width:10%;border-top:2.4px solid #6ec1e4;margin:-13px 0 22px\"><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:heading {\"level\":4} -->\n<h4 class=\"wp-block-heading\" id=\"toc-11\">Pawn \u4e0e Character<\/h4>\n<!-- \/wp:heading -->\n\n<!-- wp:paragraph -->\n<p>Pawn\u589e\u52a0 CharacterMovementComponent\u3001CapsuleComponent \u548c SkeletalMeshComponent\u8fd9\u4e09\u4e2a\u7ec4\u4ef6\u4e4b\u540e\uff0c\u5c31\u662fCharacter\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:list -->\n<ul class=\"wp-block-list\"><!-- wp:list-item -->\n<li>\u89d2\u8272\u79fb\u52a8\u7ec4\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u5f97\u89d2\u8272\u4e0d\u901a\u8fc7\u7269\u7406\u624b\u6bb5\u5f71\u54cd\uff0c\u5373\u53ef\u8fd0\u52a8\uff0c\u4e3a\u89d2\u8272\u7279\u5b9a\u3002<\/li>\n<!-- \/wp:list-item -->\n\n<!-- wp:list-item -->\n<li>\u80f6\u56ca\u4f53\u7ec4\u4ef6\u7528\u4e8e\u89d2\u8272\u8fd0\u52a8\u78b0\u649e\uff0c\u9ed8\u8ba4\u662f\u5782\u76f4\u7684\u80f6\u56ca\u4f53\u3002<\/li>\n<!-- \/wp:list-item -->\n\n<!-- wp:list-item -->\n<li>\u9aa8\u9abc\u7f51\u683c\u4f53\u7ec4\u4ef6\uff0c\u53ef\u4ee5\u4f7f\u5f97\u89d2\u8272\u542f\u7528\u9ad8\u7ea7\u7684\u9aa8\u9abc\u52a8\u753b\u3002<\/li>\n<!-- \/wp:list-item --><\/ul>\n<!-- \/wp:list -->\n\n<!-- wp:paragraph -->\n<p>\u90a3\u4ec0\u4e48\u53c8\u662fPawn\uff1f<br>Pawn \u662f\u90a3\u4e9b\u53ef\u7531\u73a9\u5bb6\u6216 AI \u63a7\u5236\u7684\u6240\u6709 Actor \u7684\u57fa\u7c7b\u3002<br>\u5b83\u6709\u4e00\u4e2a\u5b50\u7c7b DefaultPawn\uff08\u548c Character \u662f\u5e73\u7ea7\u7684\uff09\uff1b<br>DefaultPawn \u7c7b\u5305\u542b\u4e86\u539f\u751f\u7684\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:list -->\n<ul class=\"wp-block-list\"><!-- wp:list-item -->\n<li>UFloatingPawnMovement \u79fb\u52a8\u7ec4\u4ef6\u3001<\/li>\n<!-- \/wp:list-item -->\n\n<!-- wp:list-item -->\n<li>\u7403\u5f62 CollisionComponent \u7ec4\u4ef6\u3001<\/li>\n<!-- \/wp:list-item -->\n\n<!-- wp:list-item -->\n<li>\u4ee5\u53ca\u4e00\u4e2a StaticMeshComponent \u7ec4\u4ef6\uff08\u662f\u4e0d\u662f\u548cCharacter\u5f88\u76f8\u4f3c\uff1f\uff09<\/li>\n<!-- \/wp:list-item --><\/ul>\n<!-- \/wp:list -->\n\n<!-- wp:paragraph -->\n<p>SpectatorPawn \u53c8\u662f DefaultPawn \u7684\u5b50\u7c7b\uff0c\u5e38\u7528\u4e8e\u5b9e\u73b0\u89c2\u770b\u529f\u80fd\uff0c\u6682\u4e0d\u5c55\u5f00\u8ba8\u8bba\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:heading {\"level\":4} -->\n<h4 class=\"wp-block-heading\" id=\"toc-12\">Pawn \u5c42\u53ea\u8d1f\u8d23\u6512\u8f93\u5165<\/h4>\n<!-- \/wp:heading -->\n\n<!-- wp:image {\"align\":\"center\"} -->\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.xinot.icu\/wp-content\/uploads\/2026\/10\/\u4ece\u63a5\u6536\u8f93\u5165\u5230\u5b9e\u9645\u8ba9Character\u79fb\u52a8\u7684\u5927\u81f4\u94fe\u8def_\u56fe5.png\" alt=\"\"\/><\/figure>\n<!-- \/wp:image -->\n\n<!-- wp:paragraph -->\n<p>\u5982\u56fe\u662f\u6211\u7684\u89d2\u8272\u84dd\u56fe\uff0c<br>\u4e0a\u9762\u4e3a\u8fd9\u4e2a\u89d2\u8272\u6302\u8f7d\u4e86\u589e\u5f3a\u8f93\u5165\uff0c\u5e76\u4e14\u6dfb\u52a0\u4e86\u9ed8\u8ba4\u7684IMC\uff0c\u4e0b\u9762\u5219\u662f\u76f8\u5e94IMC\u91cc\u7684IA\uff0c\u5b9e\u73b0\u4e86\u89d2\u8272\u79fb\u52a8\u3002<br>\u800c\u89d2\u8272\u79fb\u52a8\u4f3c\u4e4e\u4e0eAdd Movement Input\u6709\u5173\u7cfb\uff0c\u54b1\u4eec\u53ef\u4ee5\u4ece\u8fd9\u4e2a\u84dd\u56fe\u8282\u70b9\u4f5c\u4e3a\u5207\u5165\u53e3\uff0c\u4e86\u89e3CMC\u662f\u600e\u4e48\u5904\u7406\u8f93\u5165\uff0c\u6700\u7ec8\u64cd\u63a7\u89d2\u8272\u79fb\u52a8\u7684\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>\u6839\u636eAI\u5927\u4eba\u7684\u8bf4\u6cd5\uff0cAdd Movement Input\u8282\u70b9\u5176\u5b9e\u662f\u7531Pawn\u63d0\u4f9b\u7684\uff0c\u5176\u4f5c\u7528\u53ea\u662f\u63a5\u6536\u8f93\u5165\uff0c\u5e76\u4e14\u4fdd\u5b58\u8d77\u6765\u3002<br>\u800cCMC\u8bfb\u53d6\u4e86\u4fdd\u5b58\u8d77\u6765\u7684\u8fd9\u4e9b\u8f93\u5165\uff0c\u5e76\u771f\u6b63\u79fb\u52a8\u8d77\u6765\u4e86\u89d2\u8272\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>\u8fd9\u4e5f\u662f UE \u8bbe\u8ba1\u7684\u4e00\u4e2a\u4f18\u96c5\u4e4b\u5904\uff1a\u8f93\u5165\u63a5\u6536\uff08Pawn \u5c42\uff09 \u548c \u8f93\u5165\u6267\u884c\uff08Movement Component \u5c42\uff09 \u662f\u5206\u79bb\u7684\u3002\u8fd9\u6837\u4e0d\u540c\u7684 Pawn \u5b50\u7c7b\u53ef\u4ee5\u7528\u4e0d\u540c\u7684\u79fb\u52a8\u7ec4\u4ef6\uff0c\u4f46\u90fd\u80fd\u901a\u8fc7 AddMovementInput \u8fd9\u4e2a\u7edf\u4e00\u7684\u63a5\u53e3\u63a5\u6536\u8f93\u5165\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>\u76ee\u524d\u53ef\u4ee5\u628a\u6d41\u7a0b\u7406\u89e3\u6210\u8fd9\u6837\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">IA_Move \u89e6\u53d1 \u2192\nAddMovementInput(APawn) \u2192\nControlInputVector(APawn\u5185\u90e8\u6682\u5b58) \u2192\nCMC Tick(\u8bfb\u53d6\u8fd9\u4e2a\u5411\u91cf) \u2192\n\u771f\u6b63\u6267\u884c\u79fb\u52a8<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>\u4e0b\u9762\u5bf9\u7740\u6e90\u7801\u9a8c\u8bc1\u4e00\u4e0b\u8fd9\u4e2a\u8bf4\u6cd5\u3002Pawn \u6e90\u7801\u8fd9\u91cc\u53ea\u770b AddMovementInput\uff0c\u5148\u770b\u6ce8\u91ca\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">\/**\n * Add movement input along the given world direction vector (usually normalized) scaled by 'ScaleValue'. If ScaleValue &lt; 0, movement will be in the opposite direction.\n * Base Pawn classes won't automatically apply movement, it's up to the user to do so in a Tick event. Subclasses such as Character and DefaultPawn automatically handle this input and move.\n *\n * @param WorldDirection\tDirection in world space to apply input\n * @param ScaleValue\t\tScale to apply to input. This can be used for analog input, ie a value of 0.5 applies half the normal value, while -1.0 would reverse the direction.\n * @param bForce\t\t\tIf true always add the input, ignoring the result of IsMoveInputIgnored().\n * @see GetPendingMovementInputVector(), GetLastMovementInputVector(), ConsumeMovementInputVector()\n *\/\nUFUNCTION(BlueprintCallable, Category=\"Pawn|Input\", meta=(Keywords=\"AddInput\"))\nENGINE_API virtual void AddMovementInput(FVector WorldDirection, float ScaleValue = 1.0f, bool bForce = false);<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>\u6ce8\u91ca\u5df2\u7ecf\u660e\u786e\u544a\u77e5\uff0c\u57fa\u7840 Pawn \u7c7b\u4e0d\u4f1a\u56e0\u4e3a\u6dfb\u52a0\u79fb\u52a8\u8f93\u5165\u800c\u81ea\u52a8\u79fb\u52a8\uff0c\u9700\u8981\u5728 Tick \u4e8b\u4ef6\u4e2d\u624b\u52a8\u5904\u7406\uff1b\u800c Character \u548c DefaultPawn \u7c7b\u5219\u53ef\u4ee5\u81ea\u52a8\u5904\u7406\u8fd9\u4e9b\u8f93\u5165\u5e76\u79fb\u52a8\u3002<br>\u672b\u5c3e @see \u7684\u90a3\u4e09\u4e2a\u51fd\u6570\uff0cGetPendingMovementInputVector()\u3001GetLastMovementInputVector()\u3001ConsumeMovementInputVector()\uff0c\u5c31\u662f\u540e\u9762\u5904\u7406\u8f93\u5165\u8981\u7528\u5230\u7684\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>\u7136\u540e\u770b\u4e0b\u5b9e\u73b0\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">void APawn::AddMovementInput(FVector WorldDirection, float ScaleValue, bool bForce)\n{\n    UPawnMovementComponent* MovementComponent = GetMovementComponent();\n    if (MovementComponent)\n    {\n        MovementComponent-&gt;AddInputVector(WorldDirection * ScaleValue, bForce);\n    }\n    else\n    {\n        Internal_AddMovementInput(WorldDirection * ScaleValue, bForce);\n    }\n}<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>\u5148\u786e\u8ba4\u81ea\u5df1\u8eab\u4e0a\u6709\u6ca1\u79fb\u52a8\u7ec4\u4ef6MovementComponent\uff0c<br>\u5982\u679c\u6709\uff0c\u5219\u76f4\u63a5\u5c06\u65b9\u5411\u3001\u8f93\u5165\u5f3a\u5ea6\u6570\u636e\u6253\u5305\u4e22\u7ed9\u79fb\u52a8\u7ec4\u4ef6\uff1b<br>\u82e5\u6ca1\u6709\uff0c\u5219\u76f4\u63a5\u81ea\u5df1\u6682\u5b58\u8d77\u6765\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>\u63a5\u7740\u770b\u63a5\u6536\u79fb\u52a8\u8f93\u5165\u7684\u79fb\u52a8\u7ec4\u4ef6 PawnMovementComponent\uff0c\u540c\u6837\u5148\u770b\u6ce8\u91ca\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">\/**\n * Adds the given vector to the accumulated input in world space. Input vectors are usually between 0 and 1 in magnitude. \n * They are accumulated during a frame then applied as acceleration during the movement update.\n *\n * @param WorldVector\t\tDirection in world space to apply input\n * @param bForce\t\t\tIf true always add the input, ignoring the result of IsMoveInputIgnored().\n * @see APawn::AddMovementInput()\n *\/\nUFUNCTION(BlueprintCallable, Category=\"Pawn|Components|PawnMovement\")\nENGINE_API virtual void AddInputVector(FVector WorldVector, bool bForce = false);<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>\u540c\u4e00\u5e27\u5185\uff0c\u4f1a\u5c06\u6240\u6709\u7684\u8f93\u5165\u5411\u91cf\u7d2f\u79ef\u8d77\u6765\uff0c\u7136\u540e\u5728\u79fb\u52a8\u66f4\u65b0\u7684\u65f6\u5019\u4f5c\u4e3a&#8221;\u52a0\u901f\u5ea6&#8221;\u88ab\u5e94\u7528\u3002<br>\uff08\u4e3a\u4f55\u662f\u52a0\u901f\u5ea6\uff0c\u4e3a\u4f55\u8f93\u5165\u5411\u91cf\u901a\u5e38\u662f0\u52301\uff1f\u8fd9\u4e2a\u540e\u9762\u8bfb\u5230 CMC \u7684\u65f6\u5019\u6709\u7b54\u6848\u3002\uff09<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>\u5b9e\u73b0\u53ea\u662f\u505a\u4e86\u8f6c\u53d1\u52a8\u4f5c\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">void UPawnMovementComponent::AddInputVector(FVector WorldAccel, bool bForce)\n{\n    if (PawnOwner)\n    {\n        PawnOwner-&gt;Internal_AddMovementInput(WorldAccel, bForce);\n    }\n}<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>\u5148\u786e\u8ba4\u8fd9\u4e2a\u7ec4\u4ef6\u6709\u6ca1\u6709\u6240\u5c5e\u7684Pawn\uff08PawnOwner\uff09\uff0c<br>\u7136\u540e\u5c06\u8f93\u5165\u5411\u91cf\u4e22\u56de\u7ed9\u8fd9\u4e2aPawn\u7684Internal_AddMovementInput\u65b9\u6cd5\u3002<br>\u4e5f\u5c31\u662f\u8bf4\uff0c\u4e0d\u7ba1\u6709\u6ca1\u6709\u79fb\u52a8\u7ec4\u4ef6\uff0c\u6700\u540e\u90fd\u4f1a\u8d70\u5230\u540c\u4e00\u4e2a\u5730\u65b9\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">void APawn::Internal_AddMovementInput(FVector WorldAccel, bool bForce)\n{\n    if (bForce || !IsMoveInputIgnored())\n    {\n        ControlInputVector += WorldAccel;\n    }\n}<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>\u800c Internal_AddMovementInput \u5c31\u66f4\u7b80\u5355\u4e86\uff1a\u5148\u786e\u8ba4\u5f53\u524d\u7684 Pawn \u662f\u4e0d\u662f\u53ef\u4ee5\u79fb\u52a8\u7684\u72b6\u6001\uff0c\u5982\u679c\u662f\u7684\u8bdd\uff0c\u76f4\u63a5\u5c06\u8f93\u5165\u5411\u91cf\u7d2f\u8ba1\u5230 ControlInputVector\u3002ControlInputVector \u5c31\u662f Pawn \u6682\u5b58\u73a9\u5bb6\u8f93\u5165\u7684\u5730\u65b9\uff0c\u7b49\u5f85\u88ab\u79fb\u52a8\u7ec4\u4ef6\u7edf\u4e00\u6d88\u8d39\u3002<br>\u6512\u5b8c\u4e4b\u540e\u662f\u6d88\u8d39\u3002<br>CMC \u66f4\u65b0\u65f6\u4f1a\u8c03\u7528 ConsumeInputVector \u65b9\u6cd5\uff0c\u5b83\u540c\u6837\u662f\u4e2a\u8f6c\u53d1\uff0c\u6700\u7ec8\u843d\u5230 Pawn \u7684 Internal_ConsumeMovementInputVector\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">FVector UPawnMovementComponent::ConsumeInputVector()\n{\n    return PawnOwner ? PawnOwner-&gt;Internal_ConsumeMovementInputVector() : FVector::ZeroVector;\n}<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">FVector APawn::Internal_ConsumeMovementInputVector()\n{\n    LastControlInputVector = ControlInputVector;\n    ControlInputVector = FVector::ZeroVector;\n    return LastControlInputVector;\n}<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>\u8fd9\u4e2a\u65b9\u6cd5\u5c06\u5f53\u524d\u6682\u5b58\u7684\u8f93\u5165\u5411\u91cf\u66f4\u65b0\u5230 LastControlInputVector\uff0c\u518d\u628a ControlInputVector \u6e05\u96f6\uff0c\u6700\u540e\u5c06 LastControlInputVector \u8fd4\u56de\u7ed9\u8c03\u7528\u5b83\u7684\u79fb\u52a8\u7ec4\u4ef6\u3002\u6e05\u96f6\u53ef\u4ee5\u9632\u6b62\u8f93\u5165\u8de8\u5e27\u7d2f\u79ef\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>\u6240\u4ee5\u8bf4\uff0cPawn \u5b9e\u9645\u4e0a\u4ece\u5934\u5230\u5c3e\u90fd\u6ca1\u6709\u8fdb\u884c\u89d2\u8272\u79fb\u52a8\uff0c\u53ea\u662f\u5c06\u79fb\u52a8\u610f\u56fe\uff08\u8f93\u5165\u5f3a\u5ea6\u3001\u65b9\u5411\uff09\u7d2f\u8ba1\u8d77\u6765\uff0c\u6700\u7ec8\u6210\u4e3a\u4e00\u4e2a\u52a0\u901f\u5ea6\uff0c\u4f20\u9012\u5230 MovementComponent\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>\u9898\u5916\u8bdd\uff1a\u6211\u539f\u4ee5\u4e3a\uff0c\u6709\u4e9b\u6e38\u620f\u6682\u505c\u671f\u95f4\u6ca1\u6709\u7981\u7528\u73a9\u5bb6\u8f93\u5165\uff0c\u6062\u590d\u6e38\u620f\u540e\u89d2\u8272\u77ac\u79fb\uff0c\u539f\u56e0\u5c31\u662f\u7d2f\u79ef\u4e86\u5927\u91cf\u5f85\u5904\u7406\u8f93\u5165\uff0c\u6062\u590d\u6e38\u620f\u540e CMC \u4e00\u6b21\u6027\u6d88\u8d39\u6389\u4e86\u5927\u91cf\u8f93\u5165\u3002<br>\u540e\u6765\u8bfb\u4e0b\u53bb\u53d1\u73b0\u81f3\u5c11\u6709\u4e24\u5904\u6321\u7740\u8fd9\u4ef6\u4e8b\uff1a\u4e00\u662f\u4e0b\u9762\u4f1a\u8bb2\u5230\u7684 ScaleInputAcceleration \u4f1a\u5148\u628a\u8f93\u5165\u957f\u5ea6\u4fee\u6b63\u52301\u4ee5\u5185\uff0c\u6512\u5f97\u518d\u591a\u4e5f\u53ea\u7b49\u4e8e\u63a8\u6ee1\u4e00\u6b21\u6447\u6746\uff1b\u4e8c\u662f\u6682\u505c\u65f6\uff0c\u53ea\u8981 IA \u6ca1\u52fe bTriggerWhenPaused\uff08\u9ed8\u8ba4 false\uff09\uff0c\u89e6\u53d1\u72b6\u6001\u4f1a\u88ab\u5f3a\u5236\u7f6e\u6210 None\uff0c\u56de\u8c03\u6839\u672c\u4e0d\u4f1a\u88ab\u8c03\u7528\uff0c\u4e5f\u5c31\u6512\u4e0d\u4e86\u8f93\u5165\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>\u6700\u540e\u628a\u8fd9\u4e00\u6bb5\u7684\u94fe\u8def\u68b3\u7406\u4e00\u4e0b\uff1a<br>IA_Move \u89e6\u53d1<br>    \u2193<br>APawn::AddMovementInput<br>    \u2193 (\u5982\u679c\u6709 MovementComponent)<br>UPawnMovementComponent::AddInputVector<br>    \u2193<br>APawn::Internal_AddMovementInput<br>    \u2193 (\u5b58\u50a8\u5230 Pawn \u5185\u90e8)<br>ControlInputVector \u53d8\u91cf<br>    \u2193 (\u540c\u4e00\u5e27\u7a0d\u540e\uff0cCMC Tick \u65f6)<br>UPawnMovementComponent::ConsumeInputVector()<br>    \u2193<br>\u5e94\u7528\u4e3a\u52a0\u901f\u5ea6<br>    \u2193<br>\u89d2\u8272\u79fb\u52a8<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>\u8fd9\u91cc\u6211\u7b14\u8bb0\u539f\u672c\u5199\u7684\u662f\u300c\u4e0b\u4e00\u5e27 CMC Tick \u65f6\u300d\uff0c\u5b9e\u9645\u662f\u540c\u4e00\u5e27\u3002Controller \u63a7\u5236 Pawn \u7684\u65f6\u5019\uff0c\u4f1a\u7ed9\u79fb\u52a8\u7ec4\u4ef6\u7684 Tick \u52a0\u4e00\u4e2a\u524d\u7f6e\u4f9d\u8d56\uff08AController::AddPawnTickDependency\uff09\uff0c\u6240\u4ee5 PlayerController \u5148\u5904\u7406\u5b8c\u8f93\u5165\uff0c\u540c\u4e00\u5e27\u91cc CMC \u624d Tick\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>Pawn \u5c42\u7684\u804c\u8d23\u5230\u6b64\u4e3a\u6b62\uff0c\u4e0b\u9762\u662f\u79fb\u52a8\u7ec4\u4ef6\u5c42\u76f8\u5173\u7684\u5185\u5bb9\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:heading {\"level\":4} -->\n<h4 class=\"wp-block-heading\" id=\"toc-13\">\u8f93\u5165\u53d8\u6210\u52a0\u901f\u5ea6<\/h4>\n<!-- \/wp:heading -->\n\n<!-- wp:paragraph -->\n<p>\u8fdb\u5165 CMC\uff0c\u6e90\u7801\u5728 Engine\\Source\\Runtime\\Engine\\Private\\Components\\CharacterMovementComponent.cpp\u3002<br>\u63a5\u4e0b\u6765\u770b\u8c03\u7528\u4e86 ConsumeInputVector \u7684 TickComponent \u51fd\u6570\uff0cTickComponent \u4e00\u5f00\u5934\u5c31\u628a\u8f93\u5165\u53d6\u8d70\u4e86\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">void UCharacterMovementComponent::TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction)\n{\n    \/\/ ...\n    FVector InputVector = FVector::ZeroVector;\n    bool bUsingAsyncTick = (CharacterMovementCVars::AsyncCharacterMovement == 1) &amp;&amp; IsAsyncCallbackRegistered();\n    if (!bUsingAsyncTick)\n    {\n        \/\/ Do not consume input if simulating asynchronously, we will consume input when filling out async inputs.\n        InputVector = ConsumeInputVector();\n    }\n    \/\/ ...\n            ControlledCharacterMove(InputVector, DeltaTime);\n    \/\/ ...\n}<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>TickComponent \u51fd\u6570\u62ff\u8d70\u4e86\u8f93\u5165\uff0c\u4f20\u7ed9\u4e86 ControlledCharacterMove \u51fd\u6570\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">void UCharacterMovementComponent::ControlledCharacterMove(const FVector&amp; InputVector, float DeltaSeconds)\n{\n    {\n        SCOPE_CYCLE_COUNTER(STAT_CharUpdateAcceleration);\n\n        CharacterOwner-&gt;CheckJumpInput(DeltaSeconds);\n\n        \/\/ apply input to acceleration\n        Acceleration = ScaleInputAcceleration(ConstrainInputAcceleration(InputVector));\n        AnalogInputModifier = ComputeAnalogInputModifier();\n    }\n\n    if (CharacterOwner-&gt;GetLocalRole() == ROLE_Authority)\n    {\n        PerformMovement(DeltaSeconds);\n    }\n    else if (CharacterOwner-&gt;GetLocalRole() == ROLE_AutonomousProxy &amp;&amp; IsNetMode(NM_Client))\n    {\n        ReplicateMoveToServer(DeltaSeconds, Acceleration);\n    }\n}<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>ControlledCharacterMove \u662f CMC \u771f\u6b63\u5f00\u59cb\u5904\u7406\u73a9\u5bb6\u8f93\u5165\u7684\u5730\u65b9\uff0c\u73a9\u5bb6\u8f93\u5165\u7684\u79fb\u52a8\u5411\u91cf\u4f1a\u5728\u8fd9\u91cc\u88ab\u5904\u7406\uff0c\u8f6c\u53d8\u4e3a\u52a0\u901f\u5ea6 Acceleration\u3002<br>Acceleration \u662f CMC \u6700\u6838\u5fc3\u7684\u53d8\u91cf\u4e4b\u4e00\uff0c\u8868\u793a\u8fd9\u4e00\u5e27\u89d2\u8272\u7684\u52a0\u901f\u5ea6\uff0c\u540e\u7eed\u7684\u79fb\u52a8\u8ba1\u7b97\u90fd\u4f1a\u57fa\u4e8e\u8fd9\u4e2a\u52a0\u901f\u5ea6\u6765\u8fdb\u884c\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>\u524d\u9762\u7559\u7684\u90a3\u4e2a\u95ee\u9898\uff0c\u4e3a\u4f55\u662f\u52a0\u901f\u5ea6\uff0c\u4e3a\u4f55\u8f93\u5165\u5411\u91cf\u901a\u5e38\u662f 0 \u5230 1\uff0c\u7b54\u6848\u5c31\u5728 ScaleInputAcceleration \u91cc\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">FVector UCharacterMovementComponent::ScaleInputAcceleration(const FVector&amp; InputAcceleration) const\n{\n    return GetMaxAcceleration() * InputAcceleration.GetClampedToMaxSize(1.0f);\n}<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>\u5148\u628a\u8f93\u5165\u5411\u91cf\u7684\u957f\u5ea6\u5939\u5230 1 \u4ee5\u5185\uff0c\u5f53\u4f5c 0 \u5230 1 \u7684\u300c\u5f3a\u5ea6\u300d\uff0c\u518d\u4e58\u4e0a\u6700\u5927\u52a0\u901f\u5ea6\u3002\u6240\u4ee5\u8f93\u5165\u5411\u91cf\u672c\u8eab\u4e0d\u662f\u52a0\u901f\u5ea6\uff0c\u800c\u662f\u52a0\u901f\u5ea6\u7684\u6bd4\u4f8b\u3002<br>\u5916\u9762\u90a3\u5c42 ConstrainInputAcceleration \u5219\u662f\u5728\u8d70\u8def\u6216\u4e0b\u843d\u65f6\uff0c\u628a\u8f93\u5165\u91cc\u6cbf\u91cd\u529b\u65b9\u5411\u7684\u5206\u91cf\u53bb\u6389\uff0c\u5730\u9762\u4e0a\u63a8\u6447\u6746\uff0c\u4e0d\u8be5\u63a8\u51fa\u4e00\u4e2a\u5411\u4e0a\u7684\u52a0\u901f\u5ea6\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:heading {\"level\":4} -->\n<h4 class=\"wp-block-heading\" id=\"toc-14\">\u52a0\u901f\u5ea6\u53d8\u6210\u901f\u5ea6<\/h4>\n<!-- \/wp:heading -->\n\n<!-- wp:paragraph -->\n<p>\u63a5\u4e0b\u6765\u662f\u770b\u8fd9\u4e2a\u52a0\u901f\u5ea6\u5982\u4f55\u53d8\u6210\u901f\u5ea6\u7684\uff0c\u4e5f\u5c31\u662fCalcVelocity\u51fd\u6570\uff0c<br>\u8fd9\u4e2a\u51fd\u6570\u662f\u8ba1\u7b97\u89d2\u8272\u7684\u901f\u5ea6\u7684\u6838\u5fc3\u903b\u8f91\uff0c\u5305\u62ec\u4e86\u52a0\u901f\u5ea6\u3001\u6469\u64e6\u529b\u3001\u5236\u52a8\u51cf\u901f\u5ea6\u7b49\u56e0\u7d20\u7684\u7efc\u5408\u8ba1\u7b97\u3002\u5b83\u4f1a\u6839\u636e\u5f53\u524d\u7684\u8fd0\u52a8\u6a21\u5f0f\u548c\u8f93\u5165\u6765\u66f4\u65b0\u89d2\u8272\u7684\u901f\u5ea6\u5411\u91cf\u3002<br>\u7b80\u5355\u6765\u8bf4\uff0c\u8fd9\u4e2a\u51fd\u6570\u8d1f\u8d23\u7b97\u51fa\uff0c\u89d2\u8272\u5728\u8fd9\u4e00\u5e27\u7684\u901f\u5ea6\u5411\u91cf\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>\u4e0e\u73a9\u5bb6\u79fb\u52a8\u76f8\u5173\u7684\u4ee3\u7801\u5176\u5b9e\u53ea\u6709\u8fd9\u4e9b\uff08\u8282\u9009\uff09\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">const bool bZeroAcceleration = Acceleration.IsZero();\nconst bool bVelocityOverMax = IsExceedingMaxSpeed(MaxSpeed);\n\n\/\/ \u6ca1\u6709\u8f93\u5165 -&gt; \u51cf\u901f\nif ((bZeroAcceleration &amp;&amp; bZeroRequestedAcceleration) || bVelocityOverMax)\n{\n    ApplyVelocityBraking(...);\n}\n\/\/ \u6709\u8f93\u5165 -&gt; \u4fee\u6b63\u901f\u5ea6\u65b9\u5411\nelse if (!bZeroAcceleration)\n{\n    Velocity =\n        Velocity -\n        (Velocity - AccelDir * VelSize)\n        * FMath::Min(DeltaTime * Friction, 1.f);\n}\n\n\/\/ \u6839\u636e\u52a0\u901f\u5ea6\u66f4\u65b0\u901f\u5ea6 \u2b50\u2b50\u2b50\u2b50\u2b50\nif (!bZeroAcceleration)\n{\n    Velocity += Acceleration * DeltaTime;\n\n    \/\/ \u9650\u5236\u6700\u5927\u901f\u5ea6\n    Velocity = Velocity.GetClampedToMaxSize(NewMaxInputSpeed);\n}<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>\u52a0\u901f\u5ea6\u5e94\u7528\u5230\u901f\u5ea6\u4e0a\u7684\u5173\u952e\u5c31\u662f\u6700\u540e\u90a3\u6bb5\uff1a<br>\u65b0\u7684\u901f\u5ea6 = \u5f53\u524d\u901f\u5ea6 + \u52a0\u901f\u5ea6 \u00d7 \u65f6\u95f4\u95f4\u9694\uff0c\u7136\u540e\u5939\u5230\u6700\u5927\u901f\u5ea6\u4ee5\u5185\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:heading {\"level\":4} -->\n<h4 class=\"wp-block-heading\" id=\"toc-15\">StartNewPhysics \u4e0e PhysWalking<\/h4>\n<!-- \/wp:heading -->\n\n<!-- wp:paragraph -->\n<p>\u987a\u7740\u6570\u636e\u6d41\u7ee7\u7eed\u5f80\u4e0b\uff0c\u63a5\u4e0b\u6765\u662f\u770b\u770b\u7b97\u51fa\u6765\u7684Velocity\uff0c\u662f\u5982\u4f55\u53d8\u6210\u5b9e\u9645\u4f4d\u79fb\u7684\uff0c\u6765\u5230Phys\u7cfb\u5217\u76f8\u5173\u51fd\u6570\uff0c\u8fd9\u4e9b\u90fd\u662f\u5b9e\u9645\u8ba9\u89d2\u8272\u4ea7\u751f\u4f4d\u79fb\u7684\u51fd\u6570\u3002<br>CMC\u4f1a\u6839\u636e\u5f53\u524d\u89d2\u8272\u72b6\u6001\u8c03\u7528\u4e0d\u540c\u7684Phys\u51fd\u6570\uff0c\u5176\u4e2dPhysWalking\u5730\u9762\u79fb\u52a8\u662f\u6700\u5e38\u7528\u4e5f\u6700\u91cd\u8981\u7684\u4e00\u4e2a\u3002\u9009\u62e9\u4f7f\u7528\u4e0d\u540c\u7684\u79fb\u52a8\u72b6\u6001\u7684\u51fd\u6570\u662fStartNewPhysics\uff0c\u8fd9\u4e2a\u51fd\u6570\u4f1a\u5728PerformMovement\u8fd9\u4e2a\u8d85\u5927\u51fd\u6570\u4e2d\u88ab\u8c03\u7528\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>\u5934\u6587\u4ef6\u91cc PerformMovement \u65c1\u8fb9\u662f\u8fd9\u4e48\u5199\u7684\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">\/\/ Movement functions broken out based on owner's network Role.\n\/\/ TickComponent calls the correct version based on the Role.\n\/\/ These may be called during move playback and correction during network updates.\n\/\/\n\n\/** Perform movement on an autonomous client *\/\nENGINE_API virtual void PerformMovement(float DeltaTime);\n\n\/** Special Tick for Simulated Proxies *\/\nENGINE_API virtual void SimulatedTick(float DeltaSeconds);\n\n\/** Simulate movement on a non-owning client. Called by SimulatedTick(). *\/\nENGINE_API virtual void SimulateMovement(float DeltaTime);<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>CMC\u91cc\u7684\u4e09\u4e2a\u4e3b\u8981\u7684\u79fb\u52a8\u51fd\u6570\uff0c\u4e3b\u8981\u5173\u6ce8\u672c\u5730\u73a9\u5bb6\u4e0e\u670d\u52a1\u7aef\u8c03\u7528\u7684PerformMovement\u3002<br>\u5149\u662f\u8fd9\u4e00\u4e2a\u51fd\u6570\u7684\u5b9e\u73b0\u5c31\u6709\u63a5\u8fd1\u56db\u767e\u884c\u2026\u5148\u8df3\u8fc7\u5427\uff0c\u628aPerformMovement\u7406\u89e3\u4e3aCMC\u7684\u7edf\u4e00\u8c03\u5ea6\u4e2d\u5fc3\u5373\u53ef\u3002<br>\u6240\u4ee5\u5b9e\u9645\u7684\u903b\u8f91\u94fe\u662f\u8fd9\u6837\u7684\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:image {\"align\":\"center\"} -->\n<figure class=\"wp-block-image aligncenter\"><img decoding=\"async\" src=\"https:\/\/www.xinot.icu\/wp-content\/uploads\/2026\/10\/\u4ece\u63a5\u6536\u8f93\u5165\u5230\u5b9e\u9645\u8ba9Character\u79fb\u52a8\u7684\u5927\u81f4\u94fe\u8def_\u56fe6.png\" alt=\"\"\/><\/figure>\n<!-- \/wp:image -->\n\n<!-- wp:paragraph -->\n<p>\u90a3\u770b\u5b9e\u9645\u7684PhysWalking\u4e4b\u524d\uff0c\u6211\u4eec\u4e5f\u901f\u89c8\u4e00\u773cStartNewPhysics\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">switch ( MovementMode )\n{\ncase MOVE_None:\n    break;\ncase MOVE_Walking:\n    PhysWalking(deltaTime, Iterations);\n    break;\ncase MOVE_NavWalking:\n    PhysNavWalking(deltaTime, Iterations);\n    break;\ncase MOVE_Falling:\n    PhysFalling(deltaTime, Iterations);\n    break;\ncase MOVE_Flying:\n    PhysFlying(deltaTime, Iterations);\n    break;\ncase MOVE_Swimming:\n    PhysSwimming(deltaTime, Iterations);\n    break;\ncase MOVE_Custom:\n    PhysCustom(deltaTime, Iterations);\n    break;\ndefault:\n    \/\/ ...\n    break;\n}<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>\u6838\u5fc3\u5176\u5b9e\u5c31\u662f\u4e2d\u95f4\u90a3\u4e00\u5927\u6bb5Switch\u4ee3\u7801\uff0c\u9488\u5bf9\u5f53\u524d\u4e0d\u540c\u72b6\u6001\uff0c\u8c03\u7528\u5bf9\u5e94\u7684Phys\u51fd\u6570\uff0c\u5c31\u8fd9\u4e48\u7b80\u5355\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>\u7ec8\u4e8e\u6765\u5230\u4e86\u5b9e\u9645\u79fb\u52a8\u89d2\u8272\u7684Phys\u51fd\u6570\uff0c\u8fd9\u91cc\u4ee5\u6700\u91cd\u8981\u7684PhysWalking\u4f5c\u4e3a\u9605\u8bfb\u4f8b\u5b50\u3002\u51fd\u6570\u7684\u524d\u534a\u90e8\u5206\uff0c\u662f\u4e00\u4e9b\u524d\u7f6e\u68c0\u67e5\uff0c\u4ee5\u53ca\u521d\u59cb\u5316\u53d8\u91cf\uff1b\u6838\u5fc3\u662f\u4e00\u6bb5while\u5faa\u73af\uff0c\u6240\u6709\u7684\u79fb\u52a8\u4f1a\u5728while\u5faa\u73af\u91cc\u53d1\u751f\uff1b<br>while\u5faa\u73af\u91cc\u7684\u524d\u534a\u90e8\u5206\u4f9d\u65e7\u662f\u4e00\u4e9b\u903b\u8f91\u68c0\u67e5\uff0c\u4ee5\u53ca\u53d8\u91cf\u521d\u59cb\u5316\u3002\u5faa\u73af\u6bcf\u4e00\u6b21\u53ea\u5904\u7406\u4e00\u5c0f\u6bb5\u65f6\u95f4\uff0c\u8fd9\u5c31\u662f\u5b50\u6b65\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">const float timeTick = GetSimulationTimeStep(remainingTime, Iterations);\nremainingTime -= timeTick;<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>\u4e00\u5806\u5224\u65ad\u90fd\u901a\u8fc7\u4e4b\u540e\uff0c\u5148\u7528 CalcVelocity \u7b97\u51fa\u8fd9\u4e00\u5c0f\u6bb5\u7684\u901f\u5ea6\uff0c\u771f\u6b63\u8ba9\u89d2\u8272\u5728\u5730\u9762\u79fb\u52a8\u7684\u51fd\u6570\u662fMoveAlongFloor\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">CalcVelocity(timeTick, GroundFriction, false, GetMaxBrakingDeceleration());\n\/\/ ...\nMoveAlongFloor(MoveVelocity, timeTick, &amp;StepDownResult);<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>\u79fb\u52a8\u7ed3\u675f\u4e4b\u540e\uff0c\u4f9d\u65e7\u662f\u4e00\u6bb5\u72b6\u6001\u68c0\u67e5\uff0c\u4ee5\u53ca\u4e00\u4e9b\u8fb9\u7f18\u68c0\u6d4b\u548c\u6389\u843d\u5904\u7406\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>\u5faa\u73af\u7684\u672b\u5c3e\u6709\u4e00\u6bb5\u66f4\u65b0\u5b9e\u9645\u901f\u5ea6\u7684\u4ee3\u7801\u4e5f\u503c\u5f97\u4e00\u770b\uff0c\u6839\u636e\u5b9e\u9645\u4ea7\u751f\u7684\u4f4d\u79fb\uff0c\u8ba1\u7b97\u51fa\u89d2\u8272\u7684\u5b9e\u9645\u901f\u5ea6\uff0c\u5e76\u4e14\u5c06\u5b9e\u9645\u901f\u5ea6\u8d4b\u503c\u7ed9\u7406\u8bba\u901f\u5ea6Velocity\uff0c\u8fd9\u6837\u53ef\u4ee5\u4fdd\u6301\u901f\u5ea6\u4e0e\u5b9e\u9645\u79fb\u52a8\u4e00\u81f4\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">\/\/ Make velocity reflect actual move\nif( !bJustTeleported &amp;&amp; !HasAnimRootMotion() &amp;&amp; !CurrentRootMotion.HasOverrideVelocity() &amp;&amp; timeTick &gt;= MIN_TICK_TIME)\n{\n    Velocity = (UpdatedComponent-&gt;GetComponentLocation() - OldLocation) \/ timeTick;\n    MaintainHorizontalGroundVelocity();\n}<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:heading {\"level\":4} -->\n<h4 class=\"wp-block-heading\" id=\"toc-16\">MoveAlongFloor \u5230\u5b9e\u9645\u79fb\u52a8<\/h4>\n<!-- \/wp:heading -->\n\n<!-- wp:paragraph -->\n<p>\u7ee7\u7eed\u5f80\u4e0b\u770b\u771f\u6b63\u8ba9\u89d2\u8272\u79fb\u52a8\u7684\u51fd\u6570MoveAlongFloor\uff0c\u8fd9\u4e2a\u51fd\u6570\u4f1a\u5728\u660e\u786e\u77e5\u9053\u89d2\u8272\u53ef\u4ee5\u5728\u5730\u9762\u79fb\u52a8\u65f6\u88ab\u8c03\u7528\u3002<br>\u5b83\u4f1a\u4f7f\u7528\u5f53\u524d\u7684\u5730\u9762\u4fe1\u606f\uff08CurrentFloor\uff09\u548c\u8ba1\u7b97\u51fa\u7684\u5730\u9762\u79fb\u52a8\u589e\u91cf\uff08ComputeGroundMovementDelta()\uff09\u6765\u83b7\u53d6\u79fb\u52a8\u65b9\u5411\u3002<br>\u4e5f\u4f1a\u505a\u4e00\u4e9b\u4e0d\u540c\u5730\u9762\u7684\u5904\u7406\uff0c\u5982\u679c\u78b0\u5230\u7b2c\u4e8c\u4e2a\u53ef\u884c\u8d70\u7684\u8868\u9762\uff0c\u4e5f\u4f1a\u4f7f\u7528\u76f8\u540c\u7684\u65b9\u6cd5\u8fdb\u884c\u79fb\u52a8\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>\u5bf9\u8fd9\u4e2a\u4ee3\u7801\u505a\u4e00\u4e0b\u7b80\u5316\uff0c\u5176\u5b9e\u5927\u6982\u6846\u67b6\u5c31\u662f\u5982\u4e0b\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">MoveAlongFloor()\n{\n    \/\/ \u6839\u636e\u5761\u5ea6\u8ba1\u7b97\u771f\u6b63\u79fb\u52a8\u65b9\u5411\n    RampVector =\n        ComputeGroundMovementDelta(...);\n\n    \/\/ \u771f\u6b63\u79fb\u52a8 Capsule\n    SafeMoveUpdatedComponent(...);\n\n    \/\/ \u649e\u4e1c\u897f\uff1f\n    if (Hit)\n    {\n        \/\/ \u80fd\u4e0a\u53f0\u9636\uff1f\n        StepUp();\n\n        \/\/ \u4e0d\u884c\u5c31\u6ed1\u5899\n        SlideAlongSurface();\n    }\n}<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>\u7ee7\u7eed\u5f80\u4e0b\u6df1\u6316\uff0c\u6267\u884c\u79fb\u52a8\u7684\u51fd\u6570SafeMoveUpdatedComponent\u3002<br>\u5b83\u5728CMC\u7684\u57fa\u7c7bMovementComponent\u91cc\uff08\u7ee7\u627f\u94fe\u662f CMC \u2192 PawnMovementComponent \u2192 NavMovementComponent \u2192 MovementComponent\uff09\uff0c\u5148\u770b\u5934\u6587\u4ef6\u6ce8\u91ca\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">\/**\n * Calls MoveUpdatedComponent(), handling initial penetrations by calling ResolvePenetration().\n * If this adjustment succeeds, the original movement will be attempted again.\n * @note The overload taking rotation as an FQuat is slightly faster than the version using FRotator (which will be converted to an FQuat).\n * @note The 'Teleport' flag is currently always treated as 'None' (not teleporting) when used in an active FScopedMovementUpdate.\n * @return result of the final MoveUpdatedComponent() call.\n *\/\nENGINE_API bool SafeMoveUpdatedComponent(const FVector&amp; Delta, const FQuat&amp; NewRotation,    bool bSweep, FHitResult&amp; OutHit, ETeleportType Teleport = ETeleportType::None);<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>\u8c03\u7528MoveUpdatedComponent\u6267\u884c\u79fb\u52a8\uff0c\u5e76\u4e14\u4f7f\u7528ResolvePenetration\u5904\u7406\u521d\u59cb\u7a7f\u6a21\uff1b<br>\u5982\u679c\u5904\u7406\u7a7f\u6a21\u6210\u529f\uff0c\u5219\u91cd\u65b0\u5c1d\u8bd5\u79fb\u52a8\uff1b<br>\u8fd8\u6709\u4e00\u4e9bRotator\u3001Quat\u76f8\u5173\u7684\u91cd\u8f7d\uff0c\u6682\u65f6\u8df3\u8fc7\u3002\u901f\u770b\u4e00\u773c\u5b9e\u73b0\uff0c\u5176\u5b9e\u4e5f\u662f\u5f88\u7b80\u5355\u7684Wrapper\u5305\u88c5\u5668\u903b\u8f91\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">bMoveResult = MoveUpdatedComponent(Delta, NewRotation, bSweep, &amp;OutHit, Teleport);\n\/\/ ...\n\/\/ Handle initial penetrations\nif (OutHit.bStartPenetrating &amp;&amp; UpdatedComponent)\n{\n    const FVector RequestedAdjustment = GetPenetrationAdjustment(OutHit);\n    if (ResolvePenetration(RequestedAdjustment, OutHit, NewRotation))\n    {\n        \/\/ Retry original move\n        bMoveResult = MoveUpdatedComponent(Delta, NewRotation, bSweep, &amp;OutHit, Teleport);\n    }\n}\nreturn bMoveResult;<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>\u7ee7\u7eed\u770bMoveUpdatedComponent\uff0c\u5148\u662f\u5934\u6587\u4ef6\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">\/**\n * Moves our UpdatedComponent by the given Delta, and sets rotation to NewRotation. Respects the plane constraint, if enabled.\n * @note This simply calls the virtual MoveUpdatedComponentImpl() which can be overridden to implement custom behavior.\n * ...\n * @return True if some movement occurred, false if no movement occurred. Result of any impact will be stored in OutHit.\n *\/\nbool MoveUpdatedComponent(const FVector&amp; Delta, const FQuat&amp; NewRotation,    bool bSweep, FHitResult* OutHit = NULL, ETeleportType Teleport = ETeleportType::None);<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>\u8c03\u7528MoveUpdatedComponentImpl\u6267\u884c\u79fb\u52a8\uff0c\u53ef\u4ee5\u8bf4\u53c8\u662f\u4e00\u4e2aWrapper\uff1b<br>Impl = Implementation\uff0c\u4e5f\u5c31\u662f\u771f\u6b63\u7684\u5b9e\u73b0\u3002<br>\u8fd4\u56de\u503creturn True if movement occurred\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>\u901f\u89c8\u4e00\u773c\u5b9e\u73b0\uff0c\u5176\u5b9e\u5565\u90fd\u6ca1\u5e72\uff0c\u662f\u5185\u8054\u5230\u5934\u6587\u4ef6\u7684\u51fd\u6570\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">FORCEINLINE_DEBUGGABLE bool UMovementComponent::MoveUpdatedComponent(const FVector&amp; Delta, const FQuat&amp; NewRotation, bool bSweep, FHitResult* OutHit, ETeleportType Teleport)\n{\n    return MoveUpdatedComponentImpl(Delta, NewRotation, bSweep, OutHit, Teleport);\n}<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>\u7ee7\u7eed\u770bMoveUpdatedComponentImpl\uff1a<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">bool UMovementComponent::MoveUpdatedComponentImpl( const FVector&amp; Delta, const FQuat&amp; NewRotation, bool bSweep, FHitResult* OutHit, ETeleportType Teleport)\n{\n    if (UpdatedComponent)\n    {\n        const FVector NewDelta = ConstrainDirectionToPlane(Delta);\n        return UpdatedComponent-&gt;MoveComponent(NewDelta, NewRotation, bSweep, OutHit, MoveComponentFlags, Teleport);\n    }\n\n    return false;\n}<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>\u8c03\u7528\u4e86MoveComponent\uff0c\u8fd9\u662fUE\u91cc\u6240\u6709SceneComponent\u7684\u7edf\u4e00\u79fb\u52a8\u63a5\u53e3\u3002<br>\u5bf9\u4e8eCharacter\u6765\u8bf4\uff0c\u5c31\u662f\u79fb\u52a8CapsuleComponent\u7684\u610f\u601d\uff1b\u800cMesh\u53c8\u662fAttach\u5728CapsuleComponent\u4e0a\uff0c\u6700\u7ec8\u7684\u89c6\u89c9\u6548\u679c\u5c31\u662f\u5c0f\u4eba\u6a21\u578b\u7ec8\u4e8e\u5728\u573a\u666f\u91cc\u52a8\u8d77\u6765\u4e86\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>\u6240\u4ee5\uff0cCMC\u5230\u6b64\u4e3a\u6b62\u4e86\uff0c\u7ee7\u7eed\u6df1\u5165\u7684\u8bdd\uff0c\u5c31\u662fUpdatedComponent \/ Chaos\u76f8\u5173\u7684\u5185\u5bb9\uff0c\u90a3\u662fUE\u5e95\u5c42\u78b0\u649e\u7cfb\u7edf\u76f8\u5173\u7684\u5185\u5bb9\uff0c\u4e0d\u518d\u662fCMC\u4e86\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:heading {\"level\":4} -->\n<h4 class=\"wp-block-heading\" id=\"toc-17\">\u6574\u6761\u94fe\u8def<\/h4>\n<!-- \/wp:heading -->\n\n<!-- wp:paragraph -->\n<p>\u7b80\u8981\u603b\u7ed3\u6574\u4e2a CMC \u4e3b\u7ebf\uff1a<br>\u73a9\u5bb6\u8f93\u5165 \u2192 Pawn \u7f13\u5b58\u8f93\u5165 \u2192 CMC \u6d88\u8d39\u8f93\u5165 \u2192 \u8f6c\u6362\u4e3a\u52a0\u901f\u5ea6 \u2192 \u8ba1\u7b97\u901f\u5ea6 \u2192 \u8ba1\u7b97\u4f4d\u79fb \u2192 \u79fb\u52a8 Capsule\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<div class=\"prismjs-tomorrow copy-to-clipboard\" style=\"margin-bottom:20px\"><pre class=\"highlight-height language-cpp line-numbers\"><code readonly=\"true\" class=\"language-cpp\">\u73a9\u5bb6\u6309\u952e\uff08Enhanced Input\uff09\nAddMovementInput()                 \/\/ Pawn \u63a5\u6536\u79fb\u52a8\u8f93\u5165\nAddInputVector()\nControlInputVector                 \/\/ Pawn \u6682\u5b58\u672c\u5e27\u8f93\u5165\nTickComponent()                    \/\/ CMC \u6bcf\u5e27\u66f4\u65b0\nConsumeInputVector()               \/\/ \u6d88\u8d39\u8f93\u5165\nControlledCharacterMove()\nAcceleration                       \/\/ \u8f93\u5165 \u2192 \u52a0\u901f\u5ea6\nCalcVelocity()                     \/\/ \u52a0\u901f\u5ea6 \u2192 \u901f\u5ea6\nStartNewPhysics()                  \/\/ \u6839\u636e MovementMode \u9009\u62e9\u7269\u7406\u51fd\u6570\nPhysWalking()                      \/\/ \u884c\u8d70\u6a21\u5f0f\nMoveAlongFloor()                   \/\/ \u6839\u636e\u901f\u5ea6\u8ba1\u7b97\u672c\u5e27\u4f4d\u79fb\nSafeMoveUpdatedComponent()\nMoveUpdatedComponent()\nMoveUpdatedComponentImpl()\nCapsuleComponent::MoveComponent()  \/\/ \u771f\u6b63\u79fb\u52a8\u89d2\u8272<\/code><\/pre><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>\uff08\u8fd9\u5f20\u662f\u6309\u300c\u6570\u636e\u600e\u4e48\u53d8\u300d\u6392\u7684\uff0c\u4e0d\u662f\u4e25\u683c\u7684\u8c03\u7528\u987a\u5e8f\uff1a\u4e25\u683c\u6765\u8bf4 CalcVelocity \u662f\u5728 PhysWalking \u7684\u5faa\u73af\u91cc\u88ab\u8c03\u7528\u7684\u3002\uff09<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:spacer {\"height\":\"27px\"} -->\n<div style=\"height:27px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n<!-- \/wp:spacer -->\n\n<!-- wp:heading {\"level\":3} -->\n<h3 class=\"wp-block-heading\" id=\"toc-18\">\u4e00\u4e9b\u5c0f\u7591\u8651<\/h3>\n<!-- \/wp:heading -->\n\n<!-- wp:html -->\n<div style=\"width:10%;border-top:2.4px solid #6ec1e4;margin:-13px 0 22px\"><\/div>\n<!-- \/wp:html -->\n\n<!-- wp:paragraph -->\n<p>\u8bfb\u5b8c\u8fd9\u4e00\u904d\uff0c\u6ca1\u60f3\u660e\u767d\u7684\u5730\u65b9\u5927\u6982\u6709\u8fd9\u4e9b\uff0c\u5148\u8bb0\u5728\u8fd9\u513f\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>\u524d\u9762\u90a3\u4e2a\u95ee\u9898\uff1a\u540c\u4e00\u4e2a\u5ba2\u6237\u7aef\u4e24\u4e2a\u672c\u5730\u73a9\u5bb6\u5171\u7528\u4e00\u5957 IMC\uff0c\u5176\u4e2d\u4e00\u4e2a\u6539\u4e86\u952e\u4f4d\uff0c\u600e\u4e48\u907f\u514d\u6df7\u6dc6\uff1fSubsystem \u548c IA \u5b9e\u4f8b\u90fd\u662f\u6bcf\u4e2a\u73a9\u5bb6\u4e00\u4efd\uff0c\u8fd9\u4e2a\u6211\u77e5\u9053\u4e86\uff0c\u4f46\u6539\u952e\u4f4d\u5b58\u5728\u54ea\u3001\u600e\u4e48\u6309\u73a9\u5bb6\u533a\u5206\uff0c\u65b9\u5411\u5927\u6982\u5728 IA \u4e0a\u7684 PlayerMappableKeySettings \u548c UEnhancedInputUserSettings \u90a3\u8fb9\uff0c\u8fd9\u4e24\u4e2a\u6211\u8fd8\u6ca1\u8bfb\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>PerformMovement \u63a5\u8fd1\u56db\u767e\u884c\uff0c\u8fd9\u6b21\u6574\u4e2a\u5f53\u9ed1\u76d2\u8df3\u8fc7\u4e86\u3002\u5b83\u548c StartNewPhysics \u4e4b\u95f4\u5177\u4f53\u505a\u4e86\u4ec0\u4e48\uff0c\u73b0\u5728\u8fd8\u8bf4\u4e0d\u51fa\u6765\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>\u5b50\u6b65 \/ Time Step \/ DeltaTime\uff0c\u53ea\u77e5\u9053\u6709\u8fd9\u56de\u4e8b\uff0c\u66f4\u7ec6\u8282\u7684\u4e1c\u897f\u4e5f\u4e0d\u592a\u4e86\u89e3\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:paragraph -->\n<p>\u8fd8\u6709\u6574\u4e2a\u7f51\u7edc\u90a3\u4e00\u4fa7\u3002ControlledCharacterMove \u91cc ROLE_AutonomousProxy \u8d70\u7684\u662f ReplicateMoveToServer\uff0c\u8fd9\u4e00\u6574\u6761\u5206\u652f\u6211\u5b8c\u5168\u6ca1\u78b0\uff0c\u8fd9\u7bc7\u91cc\u8d70\u7684\u90fd\u662f Authority \u90a3\u4e00\u6761\u3002<\/p>\n<!-- \/wp:paragraph -->\n\n<!-- wp:html -->\n<link rel=\"stylesheet\" href=\"https:\/\/www.xinot.icu\/wp-content\/plugins\/elementor-pro\/assets\/css\/modules\/code-highlight.min.css?ver=1.23.0\">\n<script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/prism\/1.23.0\/components\/prism-core.min.js\"><\/script>\n<script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/prism\/1.23.0\/plugins\/autoloader\/prism-autoloader.min.js\"><\/script>\n<script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/prism\/1.23.0\/plugins\/normalize-whitespace\/prism-normalize-whitespace.min.js\"><\/script>\n<script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/prism\/1.23.0\/plugins\/line-numbers\/prism-line-numbers.min.js\"><\/script>\n<script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/prism\/1.23.0\/plugins\/toolbar\/prism-toolbar.min.js\"><\/script>\n<script src=\"https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/prism\/1.23.0\/plugins\/copy-to-clipboard\/prism-copy-to-clipboard.min.js\"><\/script>\n<!-- \/wp:html -->\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>\u8fd9\u662f\u6458\u8981<\/p>\n","protected":false},"author":1,"featured_media":2540,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24],"tags":[],"class_list":["post-2638","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-24"],"_links":{"self":[{"href":"https:\/\/www.xinot.icu\/index.php?rest_route=\/wp\/v2\/posts\/2638","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xinot.icu\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xinot.icu\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xinot.icu\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xinot.icu\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2638"}],"version-history":[{"count":16,"href":"https:\/\/www.xinot.icu\/index.php?rest_route=\/wp\/v2\/posts\/2638\/revisions"}],"predecessor-version":[{"id":2664,"href":"https:\/\/www.xinot.icu\/index.php?rest_route=\/wp\/v2\/posts\/2638\/revisions\/2664"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.xinot.icu\/index.php?rest_route=\/wp\/v2\/media\/2540"}],"wp:attachment":[{"href":"https:\/\/www.xinot.icu\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2638"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xinot.icu\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2638"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xinot.icu\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2638"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}