Realistic Foot Placement - Foot IK Tutorial in Godot 3.2

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everyone waketech here and today i want to talk about my very basic and easy ik food system is definitely not perfect but it's really easy to implement and probably to further improve it if you want to follow along you need a proper character controller setup first you can use anything you want i will use my root motion test scene so let's start with some basic setup so firstly i need to move up a little bit the collision shape of your character so let's open our character scene and yeah let's select our collision shape and let's move it up so that ik system would have some space to lower foot if needed with that done we need to add few new nodes to our scene so right now i am adding a new node it will be a bond attachment and i will rename it to left foot i will attach it to my left foot bone of my character i will use it later to position a raycast note from a code and then we add a skeleton ik node i renamed skeleton ik left foot and we need to change few of its parameters and as a root bond i will use a left upper left bone and as a tip bomb i will use a left foot now we need a target note so i will create yet another note in our player scene i will place it under spatial this time and it will be a position 3d i will rename it to target container left inside this node we need to create another position 3d node let's name it target left i will explain why we need this setup later okay now we can set up our target node for skeleton ik so let's select it if we play our ik right now you can see that our foot is rotated in an oddly way so we can use our target left node and change its rotation until we achieve a foot in a rest position this way we can manipulate our target container node in a code without worrying about proper default rotation of bones [Music] we also need to enable a magnet in a skeleton ik properties and set up its position in my case it will be a 10 at z you should set up it according to your needs so let's test it we can move our target container node and our foot should follow it if we disable a magnet you can see it behaves reduced range okay and lastly we need to add a raycast node remember to enable it and set up its length at y-axis repeat those steps with the right foot as you can see with an interpolation value of icat system you can blend between animation and our target node position now we need to manipulate this interpolation value according to animation so firstly you should temporarily disable all animation trees it will be easier to work with an animation player okay so let's add yet another 3d position node and let's name it ik interpolation left we will animate and use its transform y position as an installation value and we will read it from code we saw with proper animation selected in my case working cycle create an animation key for its transform at the beginning left foot is up so the value should be zero meaning no ik system is used let's create an animation key and check use visual curve remove and use tracks okay we need to edit this point on the curve let's change its homeless size i disabled snapping so it will be easier to work with and detour we need to find another point at which a foot is moving down and we need to create another point right now our foot is connected to ground so we want to use an ik system at full strength we change its value to one i will continue this method until all animation is completed you can see the finished result on the screen right now so that's how it looks for both legs you need to trip it with this step for all of your animation you want to use with our scene setup finished let's create a script i will name it character.gd and this is the script i will use you can adapt exported values to your needs it's really simple i set up the created nodes at the top i run ik animation method for each leg and basically i read one attachment position and i move to this position right cast depending on the detected collision i recalculate foot placement and that's it you can see the final result on the screen right now i tweaked my animation graph for target notes off-screen and added some new animations it's definitely not perfect but it's really easy to implement and works good enough for many projects let me know what you think about it if you have any suggestions or questions please leave a comment below i hope you like it and see you on the next video
Info
Channel: Wojtek Pe
Views: 24,786
Rating: undefined out of 5
Keywords: Godot, Godot 3.2, IK, Foot IK, tutorial, Godot 3d, character controller, gamedev
Id: 68ypH04teuw
Channel Id: undefined
Length: 6min 16sec (376 seconds)
Published: Sun Dec 27 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.