That &@#% Fish…

So, you’d think by giving up drinking for Lent, I’d be better rested, mind sharper, body less prone to aches and generally feeling better and thinner, right?

You’d be wrong.

Felt this way after quitting smoking – there wasn’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’d stop bitching about the ‘dad bod’ Well, after the 1st week and I dropped 2 pounds, its already started to creep back up – so much for that.

See that little  &@#% fish?

You’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 ‘juice’. (as an aside, I’m reading a ton of dev blogs and a lot of them seem to focus on adding this mythical ‘juice’ that will guarantee instant sales, clear up bad breath and acne and magically make you more appealing to every gender)

I quick took the scanned image, did my usual Inkscape vector drawing> to .svg. > to Blender> extrude / texture > export to Unity.

This is where the fun begins.

I slapped a quick FSM on it – wait a random time and apply force to launch him in the air, wait for him to come back down – repeat. Simple right? No matter what I did, he kept launching into the stratosphere. NASA wishes 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.

OK – time for a different approach. ANIMATE the ^&%$#%er. Slapped a animator controller on it and decided, hey – Unity has a panel for creating animations, let’s use that! Quick added a upward motion, quick added a little rotation so it looks like he’s popping out of the water and diving back in. Slap on the ol’ Vive and BAM! Fish outta water! Jumps and returns to the same spot! GREAT!

Except when I decided, ‘put him in the water and let’s see him majestically leap out like a noble salmon swimming upstream!’ Except every time I moved him and hit ‘play’ – he’d go right back to his original start point. And no matter what I did – parent him to an empty, check (or uncheck) root motion, apply transforms to prefabs – nothing worked.

And it bothered me for days. WHY? WHY? WHY? Why should such a simple thing be so difficult 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¬† try and re-try ideas to get ol’ Fishy McFishface acting like a proper %@#% cartoon fish.

I dunno what got me to the tenuous leap of logic, but it wasn’t until days later and I was putting Number One Son to bed and it hit me: I keyframed his rotation AND position – 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’ Render Machine 2000 to remove the offending keyframes and prove my hypothesis correct.

Well, it sorta worked. Ol’ 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’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 – so it defaults if keyframes are missing.

OK- if THAT’S how you want to play – then fine. I drag the fish over to where I want him to be – add keyframes to his X & Z and finally, at long last he was where I wanted him, and I don’t care if he is a single-use asset- it works and I ain’t screwin’ with it.

Next time I’ll just animate him in Blender.

Leave a Reply