Creating Dynamic Character Movements with Foot Inverse Kinematics and Open-Source Code

  Рет қаралды 38,005

Nick Maltbie

Nick Maltbie

Күн бұрын

Пікірлер: 52
@unasapres
@unasapres Ай бұрын
This is actually masterfully done and executed. Well appreciated!
@SillyOrb
@SillyOrb Жыл бұрын
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
@NickMaltbie
@NickMaltbie Жыл бұрын
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.
@jmifyourelazy8312
@jmifyourelazy8312 Жыл бұрын
These videos are always so interesting, love the depth you explore on each topic.
@NickMaltbie
@NickMaltbie Жыл бұрын
Thanks, glad you like them!
@BudgiePanic
@BudgiePanic 3 ай бұрын
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
@batman85057
@batman85057 9 ай бұрын
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.
@user-yn1oi6iv1f
@user-yn1oi6iv1f Жыл бұрын
I literally just recently subscribed and started watching a playlist about this character, and here is a new video :D
@NickMaltbie
@NickMaltbie Жыл бұрын
I'm happy you like the videos! Let me know what you think of this one when it goes live.
@user-yn1oi6iv1f
@user-yn1oi6iv1f Жыл бұрын
​@@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.
@NickMaltbie
@NickMaltbie Жыл бұрын
@@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.
@MatthewTrecozzi
@MatthewTrecozzi Жыл бұрын
I'm looking forward to the premiere!
@Maite-AileenBrandt
@Maite-AileenBrandt Жыл бұрын
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. \ :> /
@hogoromootsutsuki4079
@hogoromootsutsuki4079 Жыл бұрын
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.
@Roxor128
@Roxor128 4 ай бұрын
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.
@NickMaltbie
@NickMaltbie 4 ай бұрын
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!
@jdhgeui2838
@jdhgeui2838 Жыл бұрын
NICK IS BACK HELL YEAH
@NickMaltbie
@NickMaltbie Жыл бұрын
Making and editing this video took two months, hopefully next one will be smaller in scope :)
@animaterob
@animaterob 7 ай бұрын
Thanks for the video. Is this only for humanoid? What about creatures who use generic avatars?
@NickMaltbie
@NickMaltbie 6 ай бұрын
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.
@jakobanzengruber8688
@jakobanzengruber8688 10 ай бұрын
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!
@JustDezz
@JustDezz Жыл бұрын
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?
@Rehd66
@Rehd66 16 күн бұрын
"With my character controller in Pacific.." 😆
@tianqigao869
@tianqigao869 Жыл бұрын
awesome tutorial!
@NickMaltbie
@NickMaltbie Жыл бұрын
Thanks! I couldn't find any other good tutorials on the topic so I thought I'd make my own.
@watercat1248
@watercat1248 7 ай бұрын
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.
@NickMaltbie
@NickMaltbie 6 ай бұрын
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.
@THE_ONLY_REAL_WAFFLE
@THE_ONLY_REAL_WAFFLE Жыл бұрын
Nice 👍
@NickMaltbie
@NickMaltbie Жыл бұрын
Thanks!
@Omnivoid22
@Omnivoid22 7 ай бұрын
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?
@NickMaltbie
@NickMaltbie 6 ай бұрын
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
@Omnivoid22
@Omnivoid22 6 ай бұрын
@@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?
@Omnivoid22
@Omnivoid22 6 ай бұрын
I wish you showed how to do all of this.
@kdawg717
@kdawg717 7 ай бұрын
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.
@NickMaltbie
@NickMaltbie 6 ай бұрын
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 :)
@ficolas2
@ficolas2 Жыл бұрын
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.
@NickMaltbie
@NickMaltbie Жыл бұрын
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!
@ficolas2
@ficolas2 Жыл бұрын
@@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.
@NickMaltbie
@NickMaltbie Жыл бұрын
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.
@ficolas2
@ficolas2 Жыл бұрын
I just noticed, the falling animation bug seems to already be reported
@zarodgaming1844
@zarodgaming1844 Жыл бұрын
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.
@NickMaltbie
@NickMaltbie Жыл бұрын
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.
@TheJungaBoon
@TheJungaBoon Жыл бұрын
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
@barterjke
@barterjke 6 ай бұрын
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.
@NickMaltbie
@NickMaltbie 6 ай бұрын
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 :)
@RaulLopez-rq6wh
@RaulLopez-rq6wh 6 ай бұрын
The mole video never came out
@Sclaraidus
@Sclaraidus Жыл бұрын
Is it just me or does this guy sound a lot like Garbaj?
@NickMaltbie
@NickMaltbie Жыл бұрын
I've seen some of their content, they make some neat stuff too.
@FromFame
@FromFame Жыл бұрын
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.
@kolupsy
@kolupsy 9 ай бұрын
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
Making a Climbing Prototype in Unity in 48 Hours
11:10
Nick Maltbie
Рет қаралды 36 М.
Why Stairs Suck in Games... and why they don't have to
11:24
Nick Maltbie
Рет қаралды 1,5 МЛН
PRANK😂 rate Mark’s kick 1-10 🤕
00:14
Diana Belitskay
Рет қаралды 11 МЛН
Motorbike Smashes Into Porsche! 😱
00:15
Caters Clips
Рет қаралды 23 МЛН
Человек паук уже не тот
00:32
Miracle
Рет қаралды 4,2 МЛН
Watch This Before Working on a Big Game in Unity
18:44
John Leorid
Рет қаралды 299 М.
Animation Bootcamp: An Indie Approach to Procedural Animation
26:13
Intro to Animation Rigging & Procedural Animation in Unity
13:33
iHeartGameDev
Рет қаралды 195 М.
Giving Personality to Procedural Animations using Math
15:30
t3ssel8r
Рет қаралды 2,6 МЛН
REALISTIC Foot Placement Using IK in Unity
30:09
b3agz
Рет қаралды 131 М.