Longtime WolfQuest players (or at least, longtime followers of this devblog) may remember the trouble we had getting the wolf’s IK system to work well. IK (Inverse Kinematics) refers to the mechanics of a chain of objects, such as bones and joints in a leg or arm, and how their positions are calculated when interacting with other objects. One of our challenging tasks in the development of the Anniversary Edition was creating an IK system for wolves, so they would interact more naturally with their environment — both the ground and other objects such as elk who were fleeing for their lives from the wolves.
Inverse Kinematics is hard -- and Inverse Kinematics for quadrupeds is really hard. So we decided to use a software plugin called Final IK, which is considered the very best IK system available for Unity. It was designed for bipeds, but the FinalIK developer added some modifications for quadrupeds, so it worked well to some degree but by no means in all the ways we wanted it to work. But it sufficed.
Since then, Mikko joined the WolfQuest team, and after focusing mainly on multiplayer for several years, he was available and interested in a new challenge, so he took on the challenge of creating a custom quadruped IK system. I asked him to explain the process:
Mikko says:
The original motivation for the new IK system was to avoiding ’space legs’ (where the wolf stood perpendicular to the slope, like walking around the exterior of a spaceship). FinalIK’s quadrupedal grounder is just two bipedal grounders glued together and it can’t handle the pose modifications necessary for making a quadrupedal animal behave sensibly on slopes. I also had improvements to bite IK in mind, given all the trouble we had with it in FinalIK — particularly how forelegs were often not positioned sensibly. I don’t recall if a simpler interface was one of my original goals, but it’s certainly become apparent as a benefit along the way. FinalIK is comprised of many separate IK components (we used fullbody IK, look at IK, grounder IK and aim IK) which partially affected the same bones. This not only necessitated assigning references at multiple places but also made it hard to reason about which part or parameter of it was responsible for what aspects of the overall pose. Something that definitely came up during implementation was tail IK. Without space legs, the tail pose on slopes was obviously wrong so I had to do something about it. Fortunately it was pretty simple, probably the simplest part in all this.
Some of the biggest and so far unresolved challenges are related to some advanced features. I’ve had to shelve a lot of code because it was taking too long and I wanted to get the basic features done first. But it may be better to concentrate on ones pertaining to currently present features. One challenge has been dealing with all the different animations with different features. I’ve identified five kinds of foot motions which have meaningful differences (stationary, sliding, gait, acyclic and airborne). Then there’s root motion (animation making the animal actually move) which required some additional work. I can’t make many assumptions about how different bones are positioned, so the IK has to be flexible and deduce a bunch of parameters from the state of bones after animation is applied. Another challenge is detecting at which points during a gait the animal’s feet touch the ground. Again I can’t assume anything about foot height or velocity during the step, so I need to analyze the animation frames in a generic way. There are at least some cases currently where grounding is detected incorrectly and I need to improve it at some point. Lack of animation is also its own challenge. If no animation is playing, nothing will reset the positions of the bones between frames. Since the IK has to take cues from the animation, there’s a risk that without an animation a feedback loop will form when it instead acts on its own result from the previous frame.
Bite IK is the most complex type of IK in use here and it took a while to arrive at a good algorithm for it….
Mikko’s full explanation is too long for YouTube, so please go here to read it:
and click on the Developer’s Blog category, then “A New IK System
___________________
The WolfQuest saga will continue! Stay tuned for more news in upcoming devblogs about it and other new features!
We do not announce specific release dates. We will release them when they are ready.
11 views
660
215
1 month ago 00:23:59 1
Decree “O VIOLET FLAME, FLOOD THE WORLD!“ #violetflame #saintgermain