So today while having a philosophical shower (as we all do) I came up with the great idea to redo my stepping system once again for my centipede.
Yay…..Why am I not excited that I came to this conclusion, read ahead.
The reason is that the other day was the first time I managed to have a good test of the new(now not so new) way I was doing the automated steps. But first I’ll tell you all about my other attempts.
My first attempt was using ray-casts, one of each ‘hip’ offset and pointing down, setup to create a point on the geometry below it. As the centipede moved across a surface each IK goal would slide along the surface perfectly, I then used a time offset to control the foot movement, going forward in time faster till the foot goal was ahead of itself, then stopping time for the foot so it came to a standstill, sticking to the ground as the body moved forwards. Repeat.
It looked something like this:
Which wasn’t too bad, apart from one major flaw, it turned out that MODO did not like creating instanced assemblies that contained these.
Now for you that haven’t used MODO or know about instanced assemblies, or assemblies for that matter, MODO has a node based editor where you can rig up complex systems to do all sorts of things, you have your usual maths nodes, nodes for changing channels, constraints, etc. There is a super handy thing you can do which is essentially group a whole lot of nodes into a singular node, with its own channels that control things inside that group, you can feed data in and it then travels through all the nodes inside and can pop data out the other side, these groups of nodes are called assemblies. Now the really powerful thing(or at least I think it is) is the ability to instance these assemblies, making the ability to create really modular systems that can be updated.
I thought with rigging a centipede with 42 legs that instanced assemblies were a must, I could have one master leg rig node, that took certain information and then output the position for the IK goal to follow, any tweaks to the rig needed later on would propagate through all 41 other legs with minimal effort.
I was wrong. The time offset node did not work correctly inside instanced assemblies. So on to the next idea since doing tweaks to each leg wasn’t ideal and I wasn’t up to scratch with my MODO scripting.
The second attempt was another look at it, I figured I could layout some predefined points where I wanted the legs to step along the path, then the IK goals would then look for the closest step and that would be its position, add some smoothing on top and the legs would organically move from one point to another.
This way looked like this:
Great, this looked good, it was more natural than before and also it was easy to adapt to changing speed and reversing as well. Yes I had to do a little more work by placing down the foot steps but this also gave me more control and I created a small rig to place particles on the surface to give me a base set of steps to start with.
So all was good, until, I also found out that the smooth modifier didn’t work correctly with instanced assemblies, so not cool…
Here came my third attempt(the last one), I decided I had to do some scripting, the only source I had to go with rigging a centipede was this great video on youtube. It was clear that I would have to do some kind of scripting to get this centipede walking on his own so I dived into the TD SDK for MODO and started to create something. Luckily I had been doing a lot of unity coding in the past year or so, this made it much easier to grasp the way to do things.
The system I was going to create was similar to the last, I kept the idea of preset step points, then through a script I check which one was closest to the current leg and that became the main point, I also checked which was the second closest, I then did a blend between the two alternating but only when the the closest point changed from what it previously was, so as a new step was about to be found I was halfway through a step, then switched back to the closest step position.
This setup looked like this:
It was OK, the movement was pretty nice and it felt great to have made a script for modo which searched through items, did some vector maths and keyed some values. But there were issues, the script itself took a minute or two to run, I didn’t know whether this was down to my scripting or the fact that for each frame 42 legs were measuring between every step on each frame of the timeline. Not only was the script was slow, since it was making keyframes, if I wanted to do a change I would have to delete the keyframes and repeat the process, even if it was only part of the animation and in the end, the ultimate goal of baking the information down to three channels for each leg was to speed up viewport feedback while animating, and as it did speed it up it was nowhere near as much as I had thought it would.
So now, since I know a bit more scripting in MODO, I think I will go back to the second system, the one that contained the smooth modifier but did not instance, reason being is that I will be able to create a script to duplicate and reconnect and assembly saving me the setup time each revision costs. Also I think its the only system that will handle this shot I want to do…