{"id":143,"date":"2017-03-18T13:33:17","date_gmt":"2017-03-18T13:33:17","guid":{"rendered":"http:\/\/fletcherstudios.net\/blog1\/?p=143"},"modified":"2017-03-18T13:33:17","modified_gmt":"2017-03-18T13:33:17","slug":"that-fish","status":"publish","type":"post","link":"https:\/\/fletcherstudios.net\/blog1\/2017\/03\/18\/that-fish\/","title":{"rendered":"That &#038;@#% Fish&#8230;"},"content":{"rendered":"<p>So, you&#8217;d think by giving up drinking for Lent, I&#8217;d be better rested, mind sharper, body less prone to aches and generally feeling better and thinner, right?<\/p>\n<p>You&#8217;d be <strong>wrong<\/strong>.<\/p>\n<p>Felt this way after quitting smoking &#8211; there wasn&#8217;t any energy boost, no taste buds came snapping back and I still felt as crappy as always, exercise or no exercise. When I stopped imbibing the night before Ash Wednesday, wifey dear commented that the pounds would melt away and I&#8217;d stop bitching about the &#8216;dad bod&#8217; Well, after the 1st week and I dropped 2 pounds, its already started to creep back up &#8211; so much for that.<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/media.giphy.com\/media\/l4FGmbPBR7msDnhza\/giphy.gif\" \/><\/p>\n<p>See that little\u00a0 <strong>&amp;@#%<\/strong> fish?<\/p>\n<p>You&#8217;d think that was an easy, quick, and painless thing to setup, eh? A 5 minute piece of fluff to add to my level and give it a little &#8216;juice&#8217;. (as an aside, I&#8217;m reading a ton of dev blogs and a lot of them seem to focus on adding this mythical &#8216;juice&#8217; that will guarantee instant sales, clear up bad breath and acne and magically make you more appealing to every gender)<\/p>\n<p>I quick took the scanned image, did my usual Inkscape vector drawing&gt; to .svg. &gt; to Blender&gt; extrude \/ texture &gt; export to Unity.<\/p>\n<p>This is where the fun begins.<\/p>\n<p>I slapped a quick FSM on it &#8211; wait a random time and apply force to launch him in the air, wait for him to come back down &#8211; repeat. Simple right? No matter what I did, he kept launching into the stratosphere. NASA <em>wishes<\/em> they could launch things so easily. Making sure gravity was turned on, played with the force variables, lowering the amount of force until it just flopped to the ground like a drunk frat boy.<\/p>\n<p>OK &#8211; time for a different approach. ANIMATE the ^&amp;%$#%er. Slapped a animator controller on it and decided, hey &#8211; Unity has a panel for creating animations, let&#8217;s use that! Quick added a upward motion, quick added a little rotation so it looks like he&#8217;s popping out of the water and diving back in. Slap on the ol&#8217; Vive and BAM! Fish outta water! Jumps and returns to the same spot! GREAT!<\/p>\n<p><a href=\"http:\/\/fletcherstudios.net\/blog1\/wp-content\/uploads\/2017\/03\/damnfish2.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-149\" src=\"http:\/\/fletcherstudios.net\/blog1\/wp-content\/uploads\/2017\/03\/damnfish2-300x74.jpg\" alt=\"\" width=\"300\" height=\"74\" srcset=\"https:\/\/www.fletcherstudios.net\/blog1\/wp-content\/uploads\/2017\/03\/damnfish2-300x74.jpg 300w, https:\/\/www.fletcherstudios.net\/blog1\/wp-content\/uploads\/2017\/03\/damnfish2-1024x252.jpg 1024w, https:\/\/www.fletcherstudios.net\/blog1\/wp-content\/uploads\/2017\/03\/damnfish2-768x189.jpg 768w, https:\/\/www.fletcherstudios.net\/blog1\/wp-content\/uploads\/2017\/03\/damnfish2.jpg 1341w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Except when I decided, &#8216;put him in the water and let&#8217;s see him majestically leap out like a noble salmon swimming upstream!&#8217; Except every time I moved him and hit &#8216;play&#8217; &#8211; he&#8217;d go right back to his original start point. And no matter what I did &#8211; parent him to an empty, check (or uncheck) root motion, apply transforms to prefabs &#8211; nothing worked.<\/p>\n<p>And it bothered me for days. WHY? WHY? WHY? Why should such a simple thing be so <em>difficult<\/em> to achieve? Why does game logic always seem so contrary to my way of thinking? I took a little time off from dev work to plod forward on the triptych for my in-laws (which is coming along nicely, thank you) and ponder this problem, occasionally taking time to\u00a0 try and re-try ideas to get ol&#8217; Fishy McFishface acting like a proper %@#% cartoon fish.<\/p>\n<p>I dunno what got me to the tenuous leap of logic, but it wasn&#8217;t until days later and I was putting Number One Son to bed and it hit me: I keyframed his rotation AND position &#8211; he literally was told to animate in THE SAME SPOT HE KEPT GOING BACK TO. I told sonny boy that daddy was dense as a brick and deserved to be slapped upside the head (he declined) and after night-nights I rushed to the ol&#8217; Render Machine 2000 to remove the offending keyframes and prove my hypothesis correct.<\/p>\n<p>Well, it sorta worked. Ol&#8217; Fishface was no longer next to the player when I hit play, but he moved to what looked like an arbitrary part of my level. It wasn&#8217;t until I was looking at his transforms that I realized it was moving to 0,0,0. Annnd looking at the animator tells me that it only accepts X, Y, AND Z &#8211; so it defaults if keyframes are missing.<\/p>\n<p>OK- if <em>THAT&#8217;S<\/em> how you want to play &#8211; then fine. I drag the fish over to where I want him to be &#8211; add keyframes to his X &amp; Z and finally, at long last he was where I wanted him, and I don&#8217;t care if he is a single-use asset- it works and I ain&#8217;t screwin&#8217; with it.<\/p>\n<p>Next time I&#8217;ll just animate him in Blender.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>So, you&#8217;d think by giving up drinking for Lent, I&#8217;d be better rested, mind sharper, body less prone to aches and generally feeling better and thinner, right? You&#8217;d be wrong. Felt this way after quitting smoking &#8211; there wasn&#8217;t any energy boost, no taste buds came snapping back and I still felt as crappy as &hellip; <a href=\"https:\/\/fletcherstudios.net\/blog1\/2017\/03\/18\/that-fish\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">That &#038;@#% Fish&#8230;<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":151,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-143","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/fletcherstudios.net\/blog1\/wp-json\/wp\/v2\/posts\/143","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fletcherstudios.net\/blog1\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fletcherstudios.net\/blog1\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fletcherstudios.net\/blog1\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fletcherstudios.net\/blog1\/wp-json\/wp\/v2\/comments?post=143"}],"version-history":[{"count":4,"href":"https:\/\/fletcherstudios.net\/blog1\/wp-json\/wp\/v2\/posts\/143\/revisions"}],"predecessor-version":[{"id":152,"href":"https:\/\/fletcherstudios.net\/blog1\/wp-json\/wp\/v2\/posts\/143\/revisions\/152"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fletcherstudios.net\/blog1\/wp-json\/wp\/v2\/media\/151"}],"wp:attachment":[{"href":"https:\/\/fletcherstudios.net\/blog1\/wp-json\/wp\/v2\/media?parent=143"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fletcherstudios.net\/blog1\/wp-json\/wp\/v2\/categories?post=143"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fletcherstudios.net\/blog1\/wp-json\/wp\/v2\/tags?post=143"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}