{"id":2382,"date":"2021-01-27T13:13:37","date_gmt":"2021-01-27T05:13:37","guid":{"rendered":"https:\/\/www.clonefactor.com\/wordpress\/?p=2382"},"modified":"2021-01-27T13:20:25","modified_gmt":"2021-01-27T05:20:25","slug":"make-locomotion-look-good-in-unity3d","status":"publish","type":"post","link":"https:\/\/www.clonefactor.com\/wordpress\/program\/unity3d\/animator-%e5%ad%b8%e7%bf%92%e7%ad%86%e8%a8%98\/2382\/","title":{"rendered":"Make Locomotion look good in Unity3D"},"content":{"rendered":"\n<p>A tips to show the work flow : Fbx Humanoid animation import into Animator.<br>after import Animation into Unity3D humanoid rig, and switch to &#8220;Animation&#8221; tab, you will find following display.<\/p>\n\n\n\n<div class=\"wp-block-media-text alignwide is-stacked-on-mobile is-vertically-aligned-top\"><figure class=\"wp-block-media-text__media\"><img loading=\"lazy\" decoding=\"async\" width=\"348\" height=\"1024\" src=\"https:\/\/www.clonefactor.com\/wordpress\/wp-content\/uploads\/2021\/01\/Rootmotion_00-1-348x1024.jpg\" alt=\"\" class=\"wp-image-2384 size-full\" srcset=\"https:\/\/www.clonefactor.com\/wordpress\/wp-content\/uploads\/2021\/01\/Rootmotion_00-1-348x1024.jpg 348w, https:\/\/www.clonefactor.com\/wordpress\/wp-content\/uploads\/2021\/01\/Rootmotion_00-1-102x300.jpg 102w, https:\/\/www.clonefactor.com\/wordpress\/wp-content\/uploads\/2021\/01\/Rootmotion_00-1.jpg 488w\" sizes=\"auto, (max-width: 348px) 100vw, 348px\" \/><\/figure><div class=\"wp-block-media-text__content\">\n<p>In this screen, you need to design how the animation import into unity3d,<br>1,2,3,4 are showing the Rootmotion data read from fbx.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>Root Transform Rotation &#8211; (section 1)<br>this are control the rotation of this animation, in this case you can see<br>section 4, &#8220;Average Angular Y Speed: <strong>0.0 deg\/s<\/strong>&#8220;, which mean this animation clip without any rotation change after 1 cycle.<\/li><li>Root Transform Position (Y) &#8211; (section 2)<br>this are control the vertical displacement (Y-axis) of this animation clip.<br>in this case you can see section 4&#8217;s &#8220;Average Velocity&#8221; in Y axis field : &#8220;-1.431&#8221;.<br>which mean this animation will MOVE UP a 1.431 for each cycle.<br>since this animation should be moving forward, shouldn&#8217;t have any Y-axis movement,<br>you can say this is noise from animation or blending issue.<br>SOLUTION 1 : Check &#8220;Bake Into Pose&#8221; option in (section 2),<br>then Unity will blend to 0 after each cycle complete.<br>SOLUTION 2: use the offset and carefully enter the number to correct the displacement on section 4, if you do it correctly you should see zero value.<br>e.g. (-0.144, <strong>0<\/strong>, 3.732) <\/li><li>Root Transform Position (XZ) &#8211; (section 3)<br>thise are control the Horizontal displacement (XZ-axis) of this animation clip.<br>in this case you can see section 4&#8217;s &#8220;Average Velocity&#8221; on both X &amp; Z axis<br>-0.144 = X axis, 3.732 = Z axis<br>it seem normal at first look, however this are also glitch, since this animation clip are moving forward, it should not have any X axis change.<br>so it&#8217;s either the init rotation angle was wrong or the animation in raw file had deviation.<br>SOLUTION : you should check &#8220;Bake into Pose&#8221; on section 1 that should fix the glitch and section 4&#8217;s -0.144 will be gone.<\/li><\/ul>\n\n\n<\/div><\/div>\n\n\n\n<p>So let&#8217;s talk about animator &#8211; locomotion<br>and setup a simple locomotion as follow.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"580\" src=\"https:\/\/www.clonefactor.com\/wordpress\/wp-content\/uploads\/2021\/01\/Rootmotion_01-1024x580.jpg\" alt=\"\" class=\"wp-image-2387\" srcset=\"https:\/\/www.clonefactor.com\/wordpress\/wp-content\/uploads\/2021\/01\/Rootmotion_01-1024x580.jpg 1024w, https:\/\/www.clonefactor.com\/wordpress\/wp-content\/uploads\/2021\/01\/Rootmotion_01-300x170.jpg 300w, https:\/\/www.clonefactor.com\/wordpress\/wp-content\/uploads\/2021\/01\/Rootmotion_01-768x435.jpg 768w, https:\/\/www.clonefactor.com\/wordpress\/wp-content\/uploads\/2021\/01\/Rootmotion_01-1536x870.jpg 1536w, https:\/\/www.clonefactor.com\/wordpress\/wp-content\/uploads\/2021\/01\/Rootmotion_01-359x203.jpg 359w, https:\/\/www.clonefactor.com\/wordpress\/wp-content\/uploads\/2021\/01\/Rootmotion_01.jpg 1690w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Section 1, is the example locomotion setup, we use &#8220;Local X&#8221; &amp; &#8220;Local Z&#8221; to streaming the <a href=\"https:\/\/www.clonefactor.com\/wordpress\/program\/math\/2288\/\" data-type=\"post\" data-id=\"2288\">local movement<\/a> to the animator,<br>and animator will use those data to blending the animation between all those { idle, forward, left, right, backward }<br>so the foot placement will be merge and looks like sync with the character movement.<\/p>\n\n\n\n<p>Section 2, why we using &#8220;1.5&#8221; on the locomotion mapping ? because the animation clip&#8217;s Average Velocity told us, the animation will moved 1.572 (forward). and other animations { backward, left, right } are similar to these value.<br>so let use it as the reference.<br><br>after that the Animator should able to blend those Animation perfect depend on the input stream.<br>and here is <a href=\"https:\/\/www.clonefactor.com\/wordpress\/program\/unity3d\/devlog\/2042\/\" data-type=\"post\" data-id=\"2042\" target=\"_blank\" rel=\"noreferrer noopener\">how you do it in programming side<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>A tips to show the work flow : Fbx Humanoid animat &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[105],"tags":[],"class_list":["post-2382","post","type-post","status-publish","format-standard","hentry","category-animator-"],"_links":{"self":[{"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/posts\/2382","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/comments?post=2382"}],"version-history":[{"count":5,"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/posts\/2382\/revisions"}],"predecessor-version":[{"id":2393,"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/posts\/2382\/revisions\/2393"}],"wp:attachment":[{"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/media?parent=2382"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/categories?post=2382"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.clonefactor.com\/wordpress\/wp-json\/wp\/v2\/tags?post=2382"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}