In working on my asset pipeline for my current Unity project, I stumbled across something handy today I hadn’t needed to use before. As such, I figured a short post might help me remember and spread a useful tip. Specifically, the AssetPostprocessor class contains a function GetPostprocessOrder(). I didn’t find the documentation to be immediately obvious, so here’s a quick example.
A couple of weeks ago, I posted up an example video for an automated Blend Shape extraction tool I made for Unity and Maya. Moving this tool back into Touch KO 2.0, I needed it to work in conjunction with another big AssetPostprocessor script that sets up my boxer prefabs. Basically, I needed to make sure that my blend shapes were all set up on the character before I start building the prefab, so that I can link them up as needed.
My first thought was to make my prefab setup script inherit from the blend shape importer, call the base method, and then call all of my setup stuff. This approach would work, provided that my base method appropriately contained controls to avoid reduplication of information. Then I stumbled across this function. All I had to do was add it to my AssetPostprocessor class that sets up my boxer prefab.
* Ensure this script executes after blend shapes have been set up
public override int GetPostprocessOrder ()
So, you’ve bought Unity Pro and the Unity Asset server. If you’re like me, in spite of its disadvantages, you really like the UAS. It’s integrated into the editor and does a much cleaner job of versioning on serialized assets than does external version control, because it operates on the project’s Library folder rather than requiring you to generate and synchronize all of the sidecar data. However, there are some key things it cannot do.
I don’t have very complicated needs like branching and so on, but I do have a library of common code that I share across projects. This library contains a bunch of useful stuff that doesn’t rely on any game systems: things like helper classes, math classes, serialization for built-in types, and so on. The trouble is, I’m often working simultaneously on a bunch of projects that share my library (or worse still parts of my library), and so it can be a pain in the neck to push the changes out across all my projects. As such, I took the time to set up a system using Subversion working on top of my UAS projects in order to synchronize my library code.
I recently finished up a new component for Unity as part of a contract job with Mixamo. For those of you who are unaware, Mixamo provides an online motion capture download and retargeting service powered by HumanIK. It lets you use sliders to creatively adjust a piece of motion capture data and then automatically retarget it onto your own hierarchy and download it for use in your game. It’s really slick and pretty affordable, so it’s definitely worth checking out, particularly for any indie developers out there.
At any rate, the component that I created is designed to let animation data, rather than procedural velocity values, drive a character’s motion in space. The component sits on top of Unity’s animation API to let you simply play, crossfade, and blend animations using any of the existing API methods, and the computer takes care of everything else after the fact. The way it works is by tracking the position and rotation of the pelvis in the space of the character’s root node for each active AnimationState and then backward applying this motion to the root node itself and snapping the pelvis back into its position hovering over the root. Since the source code is all available in the project, I won’t belabor the details too much here, but you can certainly ask me if you have any questions. (The one thing perhaps worth mentioning, as an addendum to the video, is that the pelvis forward axis is not strictly necessary for computing output: only for displaying debug information. For computation, the character’s rotation is determined using the pelvis right axis.)
Among other things, I’ve been developing some new tutorial videos for a friend (and former instructor) of mine who teaches in LA. He’s been spinning up a program focused on iPhone development using Unity, so I’ve started to put together some introductory Unity videos for him to share with his art students. As such, I’ve added a tutorials section for Unity, which currently features a video on basics. As you can see from visiting the section, I have a few more lined up in the short term, so it will be growing over time. Let me know if there’s anything specific you might like to see in the future.
I have completed my second rigging video tutorial. This one focuses on how to rig a twist structure in a forearm that is easily portable into game code, does not interfere with IK, and is not affected by Gimbal locking on the hand.