Disclaimer:
Most of the projects that I will be doing are for a game that I am developing on my own code named Project Ninjio. In short, the game is a story action driven role playing game (common referred to as an action RPG). It features 2 uniquely styled areas, one in which the cities are built to flow along with nature, and the other where the cites are hyper futuristic. The game is set in a futuristic China, where after a large war, the country is split into the two settings described above. The game is built in the Unity 3D game engine.
The Code of Inverse Kinematics
Introduction
In most modern video games, developers use a technique called inverse kinematics, commonly shortened to IK, to insure that various parts of characters are interacting with the world as they are meant to. This can be useful when a character has to touch an object at a point or for a character to plant their feet on an uneven surface. The best part about IK is that it can be coupled with normal animation to insure that the character will plant its feet on an uneven surface even when it is doing an animation like running or walking.Before and after IK, notice how the character's feet are in the ground without using IK |
How a computer sees the human body |
IK in Unity3D
In the Unity game engine, the process of IK is fairly simple to set up. As long as the character fits a normal humanoid bone structure, Unity automatically sees and understands which bones are for what part of the body (left/right foot, head, left/right hand etc). Once Unity knows that the model is correctly set up, then it will go ahead and create an avatar for the model. An avatar is a simplified bone structure that is generated from the model's original bones for the game engine to understand how certain bones interact with each other (IE. hand is connected to the arm bone). Inside of the code, you can then tell these main bones, like the hand bones and the foot bones, to move to a position and Unity will position the connected bones to the correct position.
The Code
This is just a small thing that I put together, the actual IK script used by Ninjio has more things using IK. Hopefully the comments, in green, will help those with little programming knowledge understand the process that it takes in order to get IK on one bone inside of Unity. If you would like to learn more about this, here are some links:Unity Documentation on IK
Unity documentation on the Animator class which has a whole lot more than just IK under its belt
But when none of those work then ask Google, it'll help for sure!
Gismo's thoughts
I am honestly surprised at how easy it was for me to set up IK for Bing Nu's model! Surprisingly, the hardest part of getting her IK correct was figuring out how and when to have her foot follow IK and when to follow the animation inside of the programing. I plan IK in Ninjio to allow the character's heads to turn and look at an object, pick up an object with their hand, and to make their feet actually touch the floor (no floaty feet here)!
This week's work log:
Monday November 13th: Started modeling Iron Flurry, but had to start over
Tuesday November 14th: Started modeling the Iron Flurry again
Wednesday November 15th: Finished modeling the Iron Flurry
Thursday November 16th: Textured the Iron Flurry, but for some reason it was deleted
Friday November 17th: Finished texturing the Iron Flurry
. .-- -.. . . -. .- .-. --- .. ...- .- ...