I've been reading the text book "Game Engine Architecture" and they describe something similar to your IK solution in the animation chapter, so congratulations on independently rediscovering it
Another good video that first covers the basic concepts required to then explain the core topic, all in one convenient, informative and entertaining package. Also in the video: Big bunny bonus, so keep watching. :D
I hear you say several times in here that you are not an animator, however animation is relatively easy. if you have access to blender and know how to use it, all you need is the mixamo addon which has a tool that configures a rig controller, its an ik rig thats fully configured, I have created a few animations already, including weapon animations such as sword swings, just beginning to learn how to manage animation clip lengths based on degree of motion within a clip, longer clips for bigger motions, trying to create a fighting game with nice smooth animations. came here to figure out an ik solution to sort out an animation error. in my setup I use a child of modifer on the characters hands and linked them to a bone representing a sword. got it working on the import rig, and even on the same character model but without the sword bone, but retargeting had the bone position be off your ik solution saved my project.
@@NickMaltbieI'm kinda new at unity, and I've only done 2D minigames before. I want to make a 3D game, so I'm looking at how to make a character controller. This will definitely be useful for me.
@@user-yn1oi6iv1f I’m happy you find the series useful! All the code for the project is open source so feel free to reference it however you like for your projects.
Damn, thank you very much for sharing and even explaining in detail your experiences and theoretical background on the IK topic! Since I didn't want to create animation for a past project I dived into that topic a liiittle bit as well ... and got pretty much overwhelmed by the complexity of creating IK movement for a character's feet (so I ended up skipping the lower body for that project and using IK 'just' for movement of arms and hands, lol). Also, you are a hero for sharing your work as Open Source on GitHub as well. \ :> /
It looks very natural! Only thing that stood out to me as a little unnatural was the jumping where she leaps off like a frog with her legs fully outstretched. I think applying a slight downward force first so that the character springs up out of a crouch instead would look a bit more realistic.
I wonder if perhaps it might be better to raycast from the hips rather than the knees when trying to find where to put the foot? I remember watching some GDC talk about animation, and they reduced walking to essentially the position and rotation of the foot relative to the hip, and computing the knee position on-the-fly through simple trigonometry. The talk is titled "IK Rig: Procedural Pose Animation" if you want to watch it.
Great video! Can you share how you created that Editorscript for automating the process of creating the curves for the animation. It would help me a lot😃 Edit: Nvm. I found it in your NPM Package thank you and keep up the great work!
I don't use ik for my game but I don't have the weapon hold animation isuouse that you mentioned 😅 Because in my character that hand animation and the leg animation it's different object taknly. My character it's robot so it makes sense that the hands it's indepeding and have 0 effect for the leges technically my player have wheel not leg's but important part that the hands are different entaty and have 0 effect for the walking animation. That is perfect for my fps game.
This is a common solution to split objects up into different components to be animated independently instead of using procedural animation and IK. This is also done for things like hair, capes, eyes, mouths, etc… good video for a future topic. Specifically the legs and feet often need manual adjustment to keep the player’s feet from clipping into the ground or walls.
Cool video, thanks! Could you also explain, how did you create animator controller for this character without using transitions? I know about Animator.CrossFade, but using fixed blend time for each transition doesn't work very well for me. Do you just store all transitions in some custom script/SO or don't bother and use some fixed time?
The same principles would apply. Instead of setting humanoid foot IK targets you would need to setup custom ik targets and configure them in the unity animator rig. I haven’t done it before but I want to setup a bunny character controller in the future that would need IK targets for ears as well.
would have no Ik be the issue with my feet not staying in place on the ground in unity? even tho in the animation preveiw the feet stay on the ground and dont bob up and down during the animation?
Yes, ik is originally a concept from animation and it’s often used in games to lock a player’s feet onto the ground and not interrupt existing animations for skinned mesh renderers in Unity
@@NickMaltbie ok cool cuz i was wondering why tf it was doing that. Didnt now I had to add ik in unity itself. So i gues the rig ik has no effect on that and its just to move the mesh as needed but if i wanna keep em bound to the ground i have to add ik in unity?
See the humanoid FootIK class for details - nickmaltbie.com/OpenKCC/docs/api/nickmaltbie.OpenKCC.Animation.HumanoidFootIK.html It’s in the project, checkout the example scene and remember to download the LFS artifacts :)
Hello, I am using your controller library, and I wanted to ask something, and point something out. This is a bit unrelated to the lib, but if I want to modify the animations packed with it, that are contained in an fbx, with no model, just the animation, how can I do it? I tried importing into blender, but then I couldn't export them again Also, the IK controller, doesn't account for the hip rotation when the controller starts, so if the character is rotated, because of a coordinate system change (like blender unity) or for some other reason, the feet point to the side. I fixed this, but it's a bit botchy, I may make a merge request if I manage to find a non botchy way to fix it. Another thing I want to point out is, the jump animation looks weird on landing, because the capsule collider hits the ground before the animation bones do. To correct this, either the collider size needs to change to be animated, or the animation needs to be modified so that the feet are always on the lowest part of the collider. However option 1 can cause some jank with being able to fit into places where the full collider doesn't fit. Finally I wanted to say, thanks for this project, making a good 3d character controller is a lot of work, I never managed mine to feel fully right, but this one feels pretty good.
Hey, thanks for the well thought out comment and response! For the animations, I imported them without a model to save space, as I mentioned in the video, I got the animations from Mixamo (www.mixamo.com/) but I created a ticket in the project github.com/nicholas-maltbie/OpenKCC/issues/215 for documenting how to create, modify, or add animations. I didn't consider when the avatar would be rotated away from the character, I have an existing issue for tracking the improvements for foot IK so I added it as a task to the project github.com/nicholas-maltbie/OpenKCC/issues/193 - account for player hip rotation instead of using the player forward for foot direction. For the jump animation and collider, I need to touch that up a bit more, I added a task for it in the existing ticket related to the character collider shape - github.com/nicholas-maltbie/OpenKCC/issues/210 If you have any other suggestions or comments for the project feel free to let me know or open a new issue or ticket! it might take me a while to address all the tickets because there are a lot of open ones. But the project is open source so feel free to add suggestions if you have any!
@@NickMaltbie Thanks for your reply! I did notice a few more things. There seems to be a bug where the player gets stuck on a falling animation while walking on normal terrain. I haven't researched much about this one tho, and I don't know if it's specific to some settings I'm using. Also, it would be nice if we could add animations for walking sideways, currently, using the forward walking animation for walking sideways is a big akward looking.
Hey, there is an animation for sideways walking (called strafing) and is included in the default animation controller :) For the getting stuck in terrain, that's part of this ticket for adding the skin width parameter - github.com/nicholas-maltbie/OpenKCC/issues/210 it's caused by the player being too close to the ground and physics computation getting stuck. Will take a bit of work to fully fix and not just patch over.
Could you add events to your animation at places where it steps on the ground during a walk and then do/call the ik raycasts only on those events that would make it work!?
It could work but would have a few edge cases that wouldn’t work like moving ground or if the player’s foot clips into the ground. But if you are looking for optimization for objects far away from the camera and there are lots of them this could be a worthwhile trade off.
u didn't talk about performance 🤔 I stopped using them because of that even solutions on the asset store kinda lie about it. it's hell but a true god-send that doesn't use dots should come in the form of a determined baked library ... rather than a simulated runtime calculation for each character. It's truly awful tho, both to write AND THEN to populate with all kinds of animations.
I think with my solution it only adds two to four raycasts per character per physics update. Not too much of an addition but could definitely be optimized by adding a step to disable foot IK when a character is obscured or more than x units away from the camera. Disabling or enabling the foot IK is as simple as flipping a flag. I want to write a port of the project for DOTS as well, but that will take a bit of time to fully work out all the features. If you have any questions about the code feel free to let me know. The whole project is open source and I want to add some perf testing in the future as well, I might open an issue or ticket for that in the future.
Another trick I've seen in some games like Darksiders 2 is that they only enable foot IK when standing still. Since usually, the movements are fast enough when moving that it's not as noticeable
Not to diminish an educational/explorational part of the video, personally I think the achieved result doesn't look any good, it has a lot of Uncanny valley vibe. It explains why there are no 3d person platformer games with a realistic rigs. And why everyone who uses procedural animation are doing it for some silly cartoony games. And why most of the parkour games are 1st person. But the way, the problem with moving platform is usually resolved with setting a transform of the platform as a parent for the character, when he steps on it. It resolves some of the other problems with moving platforms, like boosting player up if he jumps off it. You can see that problem in Half-life 1, jumping in a elevator results in a shorter/longer jump depending on the direction in which the elevator is moving.
Hey, thanks for the reply. I would agree that some IK leads to uncanny interactions and this can be seen in any procedural animation if you look hard enough. My implementation is very basic and just an attempt to keep the character’s feet locked to the ground when they aren’t supposed to be moving. Guiding the knee joints helps smooth out this uncanny feeling and I could add better smoothing for how the feet are locked to the ground or released for the animation. I don’t think I’ve covered my moving platform implementation. I want to avoid parenting it directly to the transform to avoid some types of errors that would be very complex to explain. It’s a good topic for future video :)
I also like doing as much as possible with animations but you can only cover so many cases and you will get limited accuracy. For consistent and proper foot placement it’s pretty much necessary to implement runtime IK like explained in the video. It’s about figuring out what tasks to solve in what way
I've been reading the text book "Game Engine Architecture" and they describe something similar to your IK solution in the animation chapter, so congratulations on independently rediscovering it
These videos are always so interesting, love the depth you explore on each topic.
Thanks, glad you like them!
Another good video that first covers the basic concepts required to then explain the core topic, all in one convenient, informative and entertaining package. Also in the video: Big bunny bonus, so keep watching. :D
Thanks! All the feedback on these videos has helped me improve my style a lot.
🐰🐰 bunny content is fun reward for end of long video.
I hear you say several times in here that you are not an animator, however animation is relatively easy. if you have access to blender and know how to use it, all you need is the mixamo addon which has a tool that configures a rig controller, its an ik rig thats fully configured, I have created a few animations already, including weapon animations such as sword swings, just beginning to learn how to manage animation clip lengths based on degree of motion within a clip, longer clips for bigger motions, trying to create a fighting game with nice smooth animations. came here to figure out an ik solution to sort out an animation error. in my setup I use a child of modifer on the characters hands and linked them to a bone representing a sword. got it working on the import rig, and even on the same character model but without the sword bone, but retargeting had the bone position be off your ik solution saved my project.
I literally just recently subscribed and started watching a playlist about this character, and here is a new video :D
I'm happy you like the videos! Let me know what you think of this one when it goes live.
@@NickMaltbieI'm kinda new at unity, and I've only done 2D minigames before. I want to make a 3D game, so I'm looking at how to make a character controller. This will definitely be useful for me.
@@user-yn1oi6iv1f I’m happy you find the series useful! All the code for the project is open source so feel free to reference it however you like for your projects.
Damn, thank you very much for sharing and even explaining in detail your experiences and theoretical background on the IK topic!
Since I didn't want to create animation for a past project I dived into that topic a liiittle bit as well ... and got pretty much overwhelmed by the complexity of creating IK movement for a character's feet (so I ended up skipping the lower body for that project and using IK 'just' for movement of arms and hands, lol).
Also, you are a hero for sharing your work as Open Source on GitHub as well. \ :> /
I'm looking forward to the premiere!
It looks very natural! Only thing that stood out to me as a little unnatural was the jumping where she leaps off like a frog with her legs fully outstretched. I think applying a slight downward force first so that the character springs up out of a crouch instead would look a bit more realistic.
I wonder if perhaps it might be better to raycast from the hips rather than the knees when trying to find where to put the foot? I remember watching some GDC talk about animation, and they reduced walking to essentially the position and rotation of the foot relative to the hip, and computing the knee position on-the-fly through simple trigonometry. The talk is titled "IK Rig: Procedural Pose Animation" if you want to watch it.
I’ll have to give it a watch, sounds very interesting. I’ll be writing this again for godot so a good chance to put some best practices into code!
NICK IS BACK HELL YEAH
Making and editing this video took two months, hopefully next one will be smaller in scope :)
Great video! Can you share how you created that Editorscript for automating the process of creating the curves for the animation. It would help me a lot😃
Edit: Nvm. I found it in your NPM Package thank you and keep up the great work!
I don't use ik for my game but I don't have the weapon hold animation isuouse that you mentioned 😅
Because in my character that hand animation and the leg animation it's different object taknly.
My character it's robot so it makes sense that the hands it's indepeding and have 0 effect for the leges
technically my player have wheel not leg's but important part that the hands are different entaty and have 0 effect for the walking animation.
That is perfect for my fps game.
This is a common solution to split objects up into different components to be animated independently instead of using procedural animation and IK. This is also done for things like hair, capes, eyes, mouths, etc… good video for a future topic. Specifically the legs and feet often need manual adjustment to keep the player’s feet from clipping into the ground or walls.
Cool video, thanks!
Could you also explain, how did you create animator controller for this character without using transitions? I know about Animator.CrossFade, but using fixed blend time for each transition doesn't work very well for me. Do you just store all transitions in some custom script/SO or don't bother and use some fixed time?
Thanks for the video. Is this only for humanoid? What about creatures who use generic avatars?
The same principles would apply. Instead of setting humanoid foot IK targets you would need to setup custom ik targets and configure them in the unity animator rig. I haven’t done it before but I want to setup a bunny character controller in the future that would need IK targets for ears as well.
I wish you showed how to do all of this.
awesome tutorial!
Thanks! I couldn't find any other good tutorials on the topic so I thought I'd make my own.
would have no Ik be the issue with my feet not staying in place on the ground in unity? even tho in the animation preveiw the feet stay on the ground and dont bob up and down during the animation?
Yes, ik is originally a concept from animation and it’s often used in games to lock a player’s feet onto the ground and not interrupt existing animations for skinned mesh renderers in Unity
@@NickMaltbie ok cool cuz i was wondering why tf it was doing that. Didnt now I had to add ik in unity itself. So i gues the rig ik has no effect on that and its just to move the mesh as needed but if i wanna keep em bound to the ground i have to add ik in unity?
Nice 👍
Thanks!
I don't understand I've download the project from Git and it has nothing to do with anything covered in this video. I'm confused.
See the humanoid FootIK class for details - nickmaltbie.com/OpenKCC/docs/api/nickmaltbie.OpenKCC.Animation.HumanoidFootIK.html
It’s in the project, checkout the example scene and remember to download the LFS artifacts :)
Hello, I am using your controller library, and I wanted to ask something, and point something out.
This is a bit unrelated to the lib, but if I want to modify the animations packed with it, that are contained in an fbx, with no model, just the animation, how can I do it? I tried importing into blender, but then I couldn't export them again
Also, the IK controller, doesn't account for the hip rotation when the controller starts, so if the character is rotated, because of a coordinate system change (like blender unity) or for some other reason, the feet point to the side. I fixed this, but it's a bit botchy, I may make a merge request if I manage to find a non botchy way to fix it.
Another thing I want to point out is, the jump animation looks weird on landing, because the capsule collider hits the ground before the animation bones do. To correct this, either the collider size needs to change to be animated, or the animation needs to be modified so that the feet are always on the lowest part of the collider. However option 1 can cause some jank with being able to fit into places where the full collider doesn't fit.
Finally I wanted to say, thanks for this project, making a good 3d character controller is a lot of work, I never managed mine to feel fully right, but this one feels pretty good.
Hey, thanks for the well thought out comment and response!
For the animations, I imported them without a model to save space, as I mentioned in the video, I got the animations from Mixamo (www.mixamo.com/) but I created a ticket in the project github.com/nicholas-maltbie/OpenKCC/issues/215 for documenting how to create, modify, or add animations.
I didn't consider when the avatar would be rotated away from the character, I have an existing issue for tracking the improvements for foot IK so I added it as a task to the project github.com/nicholas-maltbie/OpenKCC/issues/193 - account for player hip rotation instead of using the player forward for foot direction.
For the jump animation and collider, I need to touch that up a bit more, I added a task for it in the existing ticket related to the character collider shape - github.com/nicholas-maltbie/OpenKCC/issues/210
If you have any other suggestions or comments for the project feel free to let me know or open a new issue or ticket! it might take me a while to address all the tickets because there are a lot of open ones. But the project is open source so feel free to add suggestions if you have any!
@@NickMaltbie Thanks for your reply!
I did notice a few more things.
There seems to be a bug where the player gets stuck on a falling animation while walking on normal terrain. I haven't researched much about this one tho, and I don't know if it's specific to some settings I'm using.
Also, it would be nice if we could add animations for walking sideways, currently, using the forward walking animation for walking sideways is a big akward looking.
Hey, there is an animation for sideways walking (called strafing) and is included in the default animation controller :)
For the getting stuck in terrain, that's part of this ticket for adding the skin width parameter - github.com/nicholas-maltbie/OpenKCC/issues/210 it's caused by the player being too close to the ground and physics computation getting stuck. Will take a bit of work to fully fix and not just patch over.
I just noticed, the falling animation bug seems to already be reported
Could you add events to your animation at places where it steps on the ground during a walk and then do/call the ik raycasts only on those events that would make it work!?
It could work but would have a few edge cases that wouldn’t work like moving ground or if the player’s foot clips into the ground. But if you are looking for optimization for objects far away from the camera and there are lots of them this could be a worthwhile trade off.
u didn't talk about performance 🤔
I stopped using them because of that
even solutions on the asset store kinda lie about it.
it's hell but a true god-send that doesn't use dots should come in the form of a determined baked library ... rather than a simulated runtime calculation for each character.
It's truly awful tho, both to write AND THEN to populate with all kinds of animations.
I think with my solution it only adds two to four raycasts per character per physics update. Not too much of an addition but could definitely be optimized by adding a step to disable foot IK when a character is obscured or more than x units away from the camera. Disabling or enabling the foot IK is as simple as flipping a flag.
I want to write a port of the project for DOTS as well, but that will take a bit of time to fully work out all the features.
If you have any questions about the code feel free to let me know. The whole project is open source and I want to add some perf testing in the future as well, I might open an issue or ticket for that in the future.
Another trick I've seen in some games like Darksiders 2 is that they only enable foot IK when standing still. Since usually, the movements are fast enough when moving that it's not as noticeable
Not to diminish an educational/explorational part of the video, personally I think the achieved result doesn't look any good, it has a lot of Uncanny valley vibe. It explains why there are no 3d person platformer games with a realistic rigs. And why everyone who uses procedural animation are doing it for some silly cartoony games. And why most of the parkour games are 1st person.
But the way, the problem with moving platform is usually resolved with setting a transform of the platform as a parent for the character, when he steps on it. It resolves some of the other problems with moving platforms, like boosting player up if he jumps off it. You can see that problem in Half-life 1, jumping in a elevator results in a shorter/longer jump depending on the direction in which the elevator is moving.
Hey, thanks for the reply. I would agree that some IK leads to uncanny interactions and this can be seen in any procedural animation if you look hard enough. My implementation is very basic and just an attempt to keep the character’s feet locked to the ground when they aren’t supposed to be moving. Guiding the knee joints helps smooth out this uncanny feeling and I could add better smoothing for how the feet are locked to the ground or released for the animation.
I don’t think I’ve covered my moving platform implementation. I want to avoid parenting it directly to the transform to avoid some types of errors that would be very complex to explain. It’s a good topic for future video :)
The mole video never came out
Is it just me or does this guy sound a lot like Garbaj?
I've seen some of their content, they make some neat stuff too.
As interesting as this is, for my games I'd rather just animate stairs/jumping/turning/etc since I'm an animator more than a technical developer.
I also like doing as much as possible with animations but you can only cover so many cases and you will get limited accuracy. For consistent and proper foot placement it’s pretty much necessary to implement runtime IK like explained in the video. It’s about figuring out what tasks to solve in what way