{"id":341,"date":"2018-08-07T18:00:00","date_gmt":"2018-08-07T23:00:00","guid":{"rendered":"http:\/\/www.chroniclesoftright.com\/blog\/?p=341"},"modified":"2018-08-07T14:36:49","modified_gmt":"2018-08-07T19:36:49","slug":"animations-are-hard","status":"publish","type":"post","link":"https:\/\/www.chroniclesoftright.com\/blog\/2018\/08\/07\/animations-are-hard\/","title":{"rendered":"Animations are hard"},"content":{"rendered":"<p>I&#8217;ve been fighting with getting a player character animated and, as always, there are complications.\u00a0 I get that <a href=\"http:\/\/blender.org\" target=\"_blank\" rel=\"noopener\">Blender<\/a> often does things in its own special way but it&#8217;s quite frustrating that the process to export an animated character from Blender to glTF and import it into <a href=\"http:\/\/threejs.org\" target=\"_blank\" rel=\"noopener\">THREE.js<\/a> is still flaky.\u00a0 Specifically, here&#8217;s what&#8217;s happening.<\/p>\n<p>I made a character, based heavily on a model I found on <a href=\"http:\/\/opengameart.org\" target=\"_blank\" rel=\"noopener\">opengameart.org<\/a>.\u00a0 The model was not rigged so I rigged it in Blender and created a basic idle and run animation.\u00a0 As far as I can tell, the export to glTF and import into THREE.js in this simple case is perfect.\u00a0 The guy runs, I can see the animation names in the console, all is grand.\u00a0 I thought, though, &#8220;It would be nice if I could model equipment separately then just parent the equipment to different bones on the model and eventually I could change the parented equipment programmatically.&#8221;\u00a0 This is going to be necessary eventually, but for now I have punted and simply modeled a sword as part of the character&#8217;s base mesh.\u00a0 This is because parenting separate objects to a bone works perfectly inside Blender.\u00a0 The sword, in this case, moves right along with the hand to which it is parented with no issue but when I export the animation to glTF, things go funky.\u00a0 The sword&#8217;s orientation goes crazy and it becomes difficult to predict where the sword will actually appear in THREE.js.<\/p>\n<p>I honestly believe this is just something I&#8217;m not grasping about Blender but it&#8217;s frustrating nonetheless for the animations to work great until I add in the twist of parented objects, then it goes wild.\u00a0 In order to move forward what I have now is good enough.\u00a0 You can tell the guy has a sword and once I create the attack animation you&#8217;ll be able to tell he&#8217;s swinging it with the intention of doing great violence.\u00a0 Eventually I&#8217;ll need to spend some real time with this, and possibly bring in some outside expertise to get everything working correctly, but for now I&#8217;m just going to move forward with what works and not worry about it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been fighting with getting a player character animated and, as always, there are complications.\u00a0 I get that Blender often does things in its own special way but it&#8217;s quite frustrating that the process to export an animated character from Blender to glTF and import it into THREE.js is still flaky.\u00a0 Specifically, here&#8217;s what&#8217;s happening.&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-341","post","type-post","status-publish","format-standard","hentry","category-planning-and-development"],"_links":{"self":[{"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/posts\/341","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/comments?post=341"}],"version-history":[{"count":1,"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/posts\/341\/revisions"}],"predecessor-version":[{"id":342,"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/posts\/341\/revisions\/342"}],"wp:attachment":[{"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/media?parent=341"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/categories?post=341"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chroniclesoftright.com\/blog\/wp-json\/wp\/v2\/tags?post=341"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}