Bringing it to LIFE!


So, I was having a lot of problems grokking how threejs deals with animation. I mean, it seemed reasonable in theory, but I wasn't able to get it all to play nicely in my setup. And of course, this module stuff in JavaScript makes it hard to casually debug by interrogating the REPL. (Well, hard for _me_... If you have any suggestions, please comment!)

So I decided to do a "type-in" on one of the threejs examples that seemed to be close to what I needed. First I looked at the Dancing Stormtrooper: https://threejs.org/examples/?q=collada#webgl_loader_collada_skinning This got me a far piece down the road, but since it was loading Collada models (instead of GLTF) it was barfing on the animation clip setup.

Then I wound up checking out the animation/multiple example (https://threejs.org/examples/?q=animation#webgl_animation_multiple) because it used GLTF. This turned out to have exactly what I needed for bringing in the animations and using them.

If you're not of a "certain age", you might not be familiar with the concept of a type-in. Back in the day, five million years ago (or so), there was no internet, no floppy disks. If I wanted to run an interesting program I had to enter it into the computer myself like an animal. Big books were published (and I checked all of them out of my local library) with programs in the form of interminable listings of the program on the original author's computer.

If I wanted to use the program I not only had to enter all the lines one by one, scanning with my eyes and punching keys with my flesh digits. And because my machine wasn't mainstream, I had to convert the original program into its dialect of BASIC. At first, this was very arduous and disappointing. But over time, I got pretty good at it.

And that's what typing in these examples (instead of just downloading and running them and blindly trying to bash them together) gets me -- a more visceral understanding of what's going on, absorbed through my fingers. It taught me BASIC, then C, then this that and the other. Hopefully, this will give me a better foundation with threejs!

So, now, I have a worked example that I entered myself and got working, which gave me valuable setup and debugging experience. Next step, drop the sucker into my game...

Leave a comment

Log in with itch.io to leave a comment.