Unity 5 Tutorial The Built-In IK System

Поделиться
HTML-код
  • Опубликовано: 9 фев 2025
  • Let's get our selves acquainted with Unity's build-in IK System.
    Topics:
    Foot-IK
    (09:45) Foot Placement
    (41:30)Look-IK
    (52:47)Hand-IK
    Stay up to date. Subscribe!
    Support me on Patreon
    / csharpaccent
    Our Subreddit
    / unitytutorialhub
    Asset Store Page
    www.assetstore...
    Twitter
    / accenttutorials
    Tumblr
    www.tumblr.com...

Комментарии • 231

  • @uet7417
    @uet7417 8 лет назад +12

    This is probably the most useful Unity IK instruction around right now!

    • @SharpAccent
      @SharpAccent  8 лет назад +2

      +Jason Cook Thanks! Check on my other series too, the new TPS i'm doing right now for example, I have usage for it on an in game usage (IK targeting)

  • @IoanKatalinn
    @IoanKatalinn 9 лет назад +102

    48:20 - everything you need to know

  • @Tharindu87
    @Tharindu87 8 лет назад +16

    Thank you so much for this video. This is the first video I watched on implementing IK in unity. Not disappointed.

  • @rocketshader2699
    @rocketshader2699 2 года назад

    This is amazing and it's released on 2015. This channel is the top level on TPS Character Controller which is a whole area of game development.

    • @SharpAccent
      @SharpAccent  2 года назад +1

      I'm biased but i'd say top level at everything i touched xD

  • @mandisaw
    @mandisaw 10 месяцев назад +1

    Took a couple mins to get used to your accent 😅, but great tutorial! It's hard to find anything for the built-in IK system, or intermediate coding topics in general, so much appreciated 💜 Doing 1v1 combat animations with Timeline, and the built-in IK is more performant than the Store/custom options.
    (Appreciated the humor too - was thinking "Ahh, the _The Exorcist!_" right as you said it 😂)

  • @Rohroocks007
    @Rohroocks007 4 года назад

    Bro you are absolutely amazing. Struggled for so long trying to work out inverse kinematics. I'm really grateful to you.

  • @autorotate1803
    @autorotate1803 5 лет назад +4

    Great Video, helped me a lot! One little note: Script in question must be attached to a Game Object with an Animator component otherwise the OnAnimatorIK() does NOT get called.

  • @starlightcoder
    @starlightcoder 5 лет назад +3

    Great Tutorial,
    Loved 16:30-> he doesnt have a lot of left feet, he only has one ;-) made me laugh a lot ;-) really solid tutorial over all though, with a lot of information and no bullshit, great work mate!

  • @franckdavidk
    @franckdavidk 8 лет назад

    Your tutorials are incredibly helpful !
    They make things much less intimidating when talking about complex animation.
    Thanks !

  • @Gunslinger962
    @Gunslinger962 7 лет назад +4

    This is the thing I was looking for so long! Thanks man

  • @emaneisa8672
    @emaneisa8672 4 года назад +1

    please can you help me?
    how can you get left foot, right foot, and l, r hint in camera holder.. when i dorop the original leg in this it make wrong!!

  • @Vyebrows
    @Vyebrows 9 лет назад +5

    This is exactly what i have been looking for. Thanks man.

  • @missmealey
    @missmealey 3 года назад

    Great video, super useful! Got it all up and running really fast. Thanks.

    • @SharpAccent
      @SharpAccent  3 года назад

      Glad to hear it still helps after all these years

  • @dynamicvoltage9765
    @dynamicvoltage9765 4 года назад +1

    Great script, but just to give everyone a head's up on using this on a character that's not in a predetermined position at the start of your scene - you should disable the IK until your feet are actually on the ground. You can use the raycast, but don't try to place the feet until they're actually hitting the ground.

    • @mandisaw
      @mandisaw 10 месяцев назад

      In a real project, you'd add a layerMask to the raycast and some kind of isGrounded check before any of it. And maybe move the physics checks to FixedUpdate. But this is a good tutorial - focuses on the important stuff.

  • @joe6949
    @joe6949 5 лет назад +1

    I'm definitely late to finding this video but great job man! You're a life saver!

  • @zapantis1988
    @zapantis1988 9 лет назад

    φιλε ενα μεγαλο μπραβο για τα tutorials.συνεχισε ετσι....
    buddy a big bravo for your tutorials.keep it up...

    • @SharpAccent
      @SharpAccent  9 лет назад

      +achilleas zapantis Euxaristo polu! :D

  • @jerryvux
    @jerryvux 6 лет назад +1

    hi, how do u rotate your character using ik in 51:20 ?

  • @goktugsaray8855
    @goktugsaray8855 6 лет назад +1

    Great video, really helpfull. But how do you make your character stand on the ground without collider?(At 40:07 where you make collider trigger)

  • @RigvedDeshpandeArt
    @RigvedDeshpandeArt 9 лет назад +3

    I have been looking for this for weeks!
    Happy to be the 100th like on this vid =)

  • @RandomDan97
    @RandomDan97 9 лет назад +3

    The code doesn't work with my Mixamo charatcer, any ideas how to fix this problem?

  • @Elledan3101
    @Elledan3101 8 лет назад

    thank you! thank you very much!
    the best video tutorial on RUclips with unity IK system ^__^

    • @SharpAccent
      @SharpAccent  8 лет назад

      Check out the TPS redux series I did too, It's heavily based on the IK system

    • @Elledan3101
      @Elledan3101 8 лет назад +2

      ty. i'll do :)

  • @jonathano90
    @jonathano90 6 лет назад +1

    Exactly what I needed. Thank you so much :)

  • @Chrispins
    @Chrispins 9 лет назад +7

    How would you go about using a gun model to point exactly where your mouse is aimed and then using IK to get the player model to grab the gun? Would it be very hard to do in Unity 5 now?

    • @aaronshed
      @aaronshed 8 лет назад +6

      It's simple. Set the gun as a child of the camera, ik the hands to the gun.

  • @uliveulearnandregret
    @uliveulearnandregret 5 лет назад

    how did you make the IK target left and IK target right mine don't even move my character legs

  • @voter1412
    @voter1412 5 лет назад

    This helped me with some problems I had. Thanks!

  • @MohammadAlizade
    @MohammadAlizade 7 лет назад

    Thanks for tutorial but i have a problem about curves ur code is good for moving back and forth but what about left and right because my character moves side ways and has side walk animations too I tried to get distance of each leg and assign them to the opposite one.
    for example:
    if(left foot goes up) {
    increase the right foot weight & decrease left leg weight
    }
    if(right foot goes up) {
    increase the left foot weight & decrease right leg weight
    }
    result was bad "So" Help

    • @SharpAccent
      @SharpAccent  7 лет назад +1

      Why don't you add curves on those animations as well?

  • @kingdaygaming8461
    @kingdaygaming8461 5 лет назад

    Why does my right foot react to the IK but the left foot seems to not be affected?

  • @user-rc1sn7du5y
    @user-rc1sn7du5y 8 лет назад

    Might make a video like climbing?

  • @yacinearab7243
    @yacinearab7243 2 года назад +1

    Can I get a Link for this project. I need it...

  • @neetshonen
    @neetshonen 4 года назад

    Φίλε καλησπέρα , απο την ποροφορα σου λέω , είναι σίγουρα έλληνας χαχαχα.
    φτιάχνω ενα VR game για πτυχιακή και με έχεις βοηθήσει φουλ με αυτά τα Videos !!!!
    Αν σε ενδιαφέρει κατι σε VR hit me up

  • @MalbersAnimations
    @MalbersAnimations 8 лет назад +1

    Simply Amazing!!

  • @mclanebacsi
    @mclanebacsi 7 лет назад

    What does the "camera holder" contain?

  • @angelomoro8430
    @angelomoro8430 8 лет назад

    Thank you very much! I have a question regarding the origin positions to use in Raycasts. In the Update method, why do we set the origin Vector3 as a TransformPoint(Vector.zero) rather than the foot.position? The maths evades me. I tried that variable but it's not as "polished" as yours. Thanks!!

    • @SharpAccent
      @SharpAccent  8 лет назад +2

      You turn the local position to world position with TransformPoint(). I don't really remember what I did in the video exactly but if a transform is parented under another gameobject or it's part of a rig, then it's usually wise to convert the position to world.

    • @angelomoro8430
      @angelomoro8430 8 лет назад

      Oh yeah. That makes sense. As you say it's wise to convert to world position vectors. Thanks again!

  • @zilla85
    @zilla85 3 года назад

    For some reason, I need to do the raycast etc for the foot IK in OnAnimatorIK or it doesn't work correct (at least not without deactivating and activating the script in the inspector while running). Tried both Update and FixedUpdate for the raycasts, for some reason the Animator gives wrong position for the feet, like without an animation.

    • @SharpAccent
      @SharpAccent  3 года назад +1

      OnAnimatorIK updates after the animator has moved the bones, that's why, so it should have the latest position

  • @CodingWithUnity
    @CodingWithUnity 8 лет назад

    Im a bit confused, i think tis cause of the character controller script, but, my code is the same as your and it pretty much works. But when i turn my isTrigger on the collider on and try to walk over a small object like you do his foot lifts to where to needs to be but does not lift the character like yours does :/ If i turn the trigger off it works, but then only on slopes.
    Then when in idle, his foot moves back to the plane because the raycast moves past the object the foot lifted onto during the walk animation

    • @SharpAccent
      @SharpAccent  8 лет назад

      The controller was more like an example here and not really a full working one, you need to handle the elevation of the character differently in this case.

    • @CodingWithUnity
      @CodingWithUnity 8 лет назад

      May i ask how your character was being lifted up with isTrigger turned on in your collider?
      I understand your controller was an example, but using my controller i was unable to reproduce the same results. (I tried the default third person controller and a small rigidbody controller i made. Does the character movement have to be based off animation and not physics for it to work as it does in your example?)

    • @SharpAccent
      @SharpAccent  8 лет назад +1

      I think I just raised the collider a bit higher from what it is, so his feet will go through the floor if there wasn't any IK. it's at 29:55 , of course this probably isn't that elegant for an actual game

  • @lostdeeper
    @lostdeeper 4 года назад

    he made eye ik even tho he doesnt see the eyes right??

  • @inderdeepsingh2378
    @inderdeepsingh2378 8 лет назад

    Super Like
    👍🏻
    THnaks a lot for uploading/teaching us very useful stuff

  • @DorothyJeanThompson
    @DorothyJeanThompson 9 лет назад

    does foot IK work with an animator over-ride controller? i seem to have issues.

  • @RoffeDH
    @RoffeDH 7 лет назад

    Excellent tutorial! Thank you so much!

  • @yourcommander3412
    @yourcommander3412 6 лет назад

    I really wish I watch this first , then spend 10 times the length of this video trying to figure it out myself.

  • @Uselesscommentary
    @Uselesscommentary 9 лет назад +1

    It amazing, absolutely love it ! But dude, you're left and right are on different sides :D

    • @SharpAccent
      @SharpAccent  9 лет назад +1

      +WendaF's Yeah I might have been :P

  • @lewisboby7630
    @lewisboby7630 6 лет назад

    Is there no way of deciding two points at either end of the foot to avoid glitched and restraints where the character cannot walk there as its not possible for the animation.

    • @SharpAccent
      @SharpAccent  6 лет назад

      You could probably just add a bit more logic and restrains to them

  • @jupitersky
    @jupitersky 7 лет назад

    I love this tutorial! It helped me a ton!
    Nice accent ;D

  • @mikethegamedev
    @mikethegamedev 4 года назад

    Such an childhood that i watch

  • @jerryvux
    @jerryvux 6 лет назад

    Hi, i setted up exactly as what you do from the beginning to 5:29, but when moved my IKtarget close to my character's leg, his knee didn't bent, pls help me

    • @jerryvux
      @jerryvux 6 лет назад

      oh, i figure it out, this' a great video, love it!!!

    • @marvyn3848
      @marvyn3848 6 лет назад +1

      Can you tell me how you did please ? i have the same problem

    • @jerryvux
      @jerryvux 6 лет назад

      try to switch your character model rig to Humanoid

  • @111shooter1111
    @111shooter1111 9 лет назад

    And how I can play animations which move weapon? Attach weapon to hand?

  • @nuevostitanes2
    @nuevostitanes2 8 лет назад

    Good video.
    But what about the hint's in the knees? don't you restore them?

    • @SharpAccent
      @SharpAccent  8 лет назад

      Restore them?

    • @nuevostitanes2
      @nuevostitanes2 8 лет назад

      Sorry about my bad english. I mean, the beginning of the video you put the SetIKPositions and SetIkHintPosition etc...
      after that you improved the SetIKPositions (for the feets) , i was wondering if you would do the same with SetIKhintPosition's
      Thanks a lot.

    • @SharpAccent
      @SharpAccent  8 лет назад +1

      If it's needed yes I do it, most of the time you won't need it though. If you look into my climb system you'll see I use the hints there a lot

    • @nuevostitanes2
      @nuevostitanes2 8 лет назад +1

      AAAh!
      Thanks a lot, i will check it!

  • @harrybritten1880
    @harrybritten1880 8 лет назад

    Great tutorial thanks

  • @lirantwik
    @lirantwik 8 лет назад

    really great stuff , thank you!

  • @Gann4Games
    @Gann4Games 8 лет назад

    I have set the Foot IK/Foot placement, with the complete script, it works, but the foots follows the Root X & Z orientation, or sometimes the foot looks to the original position, why this happens?

    • @SharpAccent
      @SharpAccent  8 лет назад

      You don't update correctly the target positions probably, recheck your script and make sure you're not hitting the collider of your controller

    • @Gann4Games
      @Gann4Games 8 лет назад

      The collider layer is set Ignore Raycast, i checked the script as i can, cause i dont know so much about Vector3, and about Quaternons, i need to learn about that.
      Maybe the axis of the feet bones is the problem...

  • @brian10508
    @brian10508 7 лет назад

    extremely useful, thanks a lot!

  • @DorothyJeanThompson
    @DorothyJeanThompson 8 лет назад

    Thanks you sooo much I finally watched this and it works great. Thanks!

    • @SharpAccent
      @SharpAccent  8 лет назад

      You're welcome :)

    • @Ravanous
      @Ravanous 8 лет назад

      Hey Dorothy! It's foxdit from VRTK's slack. Looks like we found the same video :)

    • @DorothyJeanThompson
      @DorothyJeanThompson 8 лет назад

      Ravanous haha! Yeah it's a really good tutorial. Works great!!!

  • @DavionSobek
    @DavionSobek 8 лет назад

    I have a weird question. I am a 3D generalist thinking about taking up game design as a potential hobby but I currently have no experience. Something I want to do is create a simple mech simulation where by the IK animation itself drives the forward movement (the actual foot friction) like in Sumotori Dreams ruclips.net/video/D1Cb6EzeEPY/видео.html but with the anti-roll feature you often see on vehicles to prevent them from rolling in order to simulate an internal gyroscope that turns off in the event the tilt is too extreme in order to simulate falling over if on a grade too steep or struck be a very hard attack. Would it be possible?
    P.S. You might see this question on other videos as I am asking around.
    P.P.S. I am well aware that even if it were possible that it would likely be quite beyond what a beginner could hope to achieve so I expect a lot of learning first.
    Thanks!

    • @SharpAccent
      @SharpAccent  8 лет назад +1

      Everything is possible if you think the logic behind it and that's pretty much the hard part, everything else can be done. In the video you linked I don't see anything that is beyond Unity's capabilities tbh

    • @DavionSobek
      @DavionSobek 8 лет назад

      Awesome, thanks for the reply!

  • @MsYourMa
    @MsYourMa 6 лет назад

    I've been having a big problem where when I enter play mode, my models feet are rotated sideways in the same direction.

    • @SharpAccent
      @SharpAccent  6 лет назад

      You need to find the correct rotation based on your model that's why

    • @MsYourMa
      @MsYourMa 6 лет назад

      I'm confused to what you mean as in the correct rotation of my model?

  • @rasengan720
    @rasengan720 9 лет назад

    when making a recoil system for the shooting of a gun, is it a good idea to manipulate the transforms that the IK is dependent upon?

    • @SharpAccent
      @SharpAccent  9 лет назад

      +rasengan720 Depends which ones you mean, but in most cases I can imagine there's going to be any problem

    • @SharpAccent
      @SharpAccent  9 лет назад

      +C Sharp Accent Tutorials *can't imagine

    • @rasengan720
      @rasengan720 9 лет назад

      Ah! Great! and thanks for the immediate reply! I have another doubt though.. is your method of using raycasting advised for such similar situations and when working in games for mobile? as raycasting can be taxing on mobiles :P

    • @SharpAccent
      @SharpAccent  9 лет назад

      Well depends again, I can't imagine a mobile game that has a need for foot IK tbh, that's luxuries for the mobile market :P

    • @rasengan720
      @rasengan720 9 лет назад

      haha true that!

  • @zacharyshah4482
    @zacharyshah4482 7 лет назад

    my character keeps floating up does anyone have this problem ? No errors
    Edit: I fixed this by baking position and rotation into pose but my walk animation will not play

  • @2rajjjkjjkkjj
    @2rajjjkjjkkjj 8 лет назад

    i tried to find about terms like " Hint " and " Weight ", what they actually mean you please point me to thr right direction where i can get to know about these terms ?

    • @SharpAccent
      @SharpAccent  8 лет назад +1

      When you use IK, it's basically an interpolation between the starting position a bone (or a chain of bones) will have, towards the target position. In the context of IK, the starting position is the position the animation has. Now weight is basically the influence towards that position, so in a percentage of 0 to 1 (1 being 100%) will the bone be towards the target position. Hint is basically the where the midpoint of the chain should be looking, so basically if you have a chain of two bones, where those bones should look if the target position is shorter than the length of the chain. You can find more info here docs.unity3d.com/Manual/InverseKinematics.html however everything that has to do with IK is basically applied trigonometry

    • @2rajjjkjjkkjj
      @2rajjjkjjkkjj 8 лет назад

      Thanks a lot. Its really helpful.

  • @vincentgiron2831
    @vincentgiron2831 9 лет назад

    Is this character/model is free in asset store? Please message me..

  • @ponx21
    @ponx21 9 лет назад

    anim.getFloat("LeftFoot"); return 0 all the time, i already configure the corves but the ik only works if i set lFweight = 1 manually. can you public the code at the

    • @SharpAccent
      @SharpAccent  9 лет назад

      victor camacho macias Check the spelling, they must have the same name inside the animator as it is in the curves, they are case sensitive so that means they have to be the exact character, so no spaces if you don't have any and capitals where they are needed. If the script doesn't gives an error then the problem is from the settings inside Unity

  • @filiprudzinski4490
    @filiprudzinski4490 6 лет назад

    Wonderful tutorial. But why didin't post code?

  • @zozobra226
    @zozobra226 7 лет назад

    please answer someone please please please.
    my first person camera has a hand. the hand wants to interact with,say,a valve. it has to pull it down. how should i do this? in a little detail please.

    • @SharpAccent
      @SharpAccent  7 лет назад

      Animate the valve, but an IK target as a child of the valve, then use that IK target for the hand you want to use. If you have an animation for the hands as well you can use curves to be exact on when the hands are touching the valve or not

    • @zozobra226
      @zozobra226 7 лет назад

      thanks man. ill subscribe to your channel from both my accounts now.

  • @ThisIsAUsername69
    @ThisIsAUsername69 8 лет назад

    Hey, I'm still on first half of the tutorial and have a problem. On flat ground, idle animation and IK the legs sort of both equally slide off to the right and stay there. I set up everything exactly and quadruple checked it. When I move the char up way above ground the feet move under him but when on normal height they slide off to some direction. Usually to the right. Not necessarily attached to the floor Tested with no colliders or any other script attached. And don't think the knees are bending at all. Unity 5.5 here. Any ideas? xD
    EDIT: Seems to be working if I use a different model. I'm using the Challenger from The Blacksmith Unity demo and it doesn't work on it. I don't know why. Everything seems set up right in the avatar, but it doesn't work and using some other avatar doesn't work either.

    • @SharpAccent
      @SharpAccent  8 лет назад

      If it's sliding away or any other weird behavior, it's from the scripts. The target position probably updates without a need to.

    • @ThisIsAUsername69
      @ThisIsAUsername69 8 лет назад

      I came to the conclusion the Unity's Challenger character I'm using is rigged weird or something, so its doing that. It's Avatar seems properly configured though. With a Mixamo character its all fine. I followed using a combat stance idle. Didn't yet get to the walking part. Thanks for the tutorials. I'll move to the climbing series soon, after I mess with the basics a bit. :)
      Wish I could import the Challenger to Blender and see whats wrong with it. But Blender is giving me errors when I try to import.

    • @SharpAccent
      @SharpAccent  8 лет назад

      Yeap blender doesn't import .fbx, one of the biggest reasons I stopped using it. It makes editing or fixing stuff pretty much impossible

    • @ThisIsAUsername69
      @ThisIsAUsername69 8 лет назад

      There's an import .fbx option, and I haven't used it much other than reimporting my own models I previously exported, but yeah it seems to sometimes not like what you're importing.

    • @SharpAccent
      @SharpAccent  8 лет назад

      It only works with some versions of .fbx and not always, it's really bad implemented. It was stable at 2.76 something i think but still had a lot of problems

  • @jjr5550
    @jjr5550 9 лет назад

    Does AvatarIKGoal only work for Mecanim? How does Unity recognize this?

  • @EarthisaCylinder
    @EarthisaCylinder 7 лет назад

    I ve problems with those hint objects, my code is looking exactly the same as yours, but i can't get it to working right, any ideas or thoughts about it? Would appreciate it

    • @SharpAccent
      @SharpAccent  7 лет назад

      Depends what isn't working right

    • @EarthisaCylinder
      @EarthisaCylinder 7 лет назад

      the elbow bone is basically unaffected

    • @SharpAccent
      @SharpAccent  7 лет назад

      I'm going to guess that you forgot to assign the weight to it. It's like the other ik goals, you have to assign both a target position and a target weight, separate from the avatarIkgoals.
      It's basically this two Animator.SetIKHintPosition and Animator.SetIKHintPositionWeight.
      docs.unity3d.com/ScriptReference/AvatarIKHint.html

    • @EarthisaCylinder
      @EarthisaCylinder 7 лет назад

      These are my lines of code.
      anim.SetIKHintPositionWeight(AvatarIKHint.LeftKnee, ikWeight);
      anim.SetIKHintPositionWeight(AvatarIKHint.RightKnee, ikWeight);
      anim.SetIKHintPosition(AvatarIKHint.LeftKnee, hintLeft.position);
      anim.SetIKHintPosition(AvatarIKHint.RightKnee, hintRight.position);

    • @SharpAccent
      @SharpAccent  7 лет назад +1

      if the ik weight is set then you probably have the positions way to close to the character, they need to be very far away from him to see real change

  • @224spiderman
    @224spiderman 7 лет назад

    Thanks for this video. It's a big help.
    Can somebody please explain me the curves, LeftFoot and RightFoot? Because, it seems as if the value of leftfoot becomes 0 when leftfoot is down on ground but it should be the opposite and same for the rightfoot. I am confused.

    • @SharpAccent
      @SharpAccent  7 лет назад +1

      There's to ways to apply them. One is exactly as you add them, so 0-1 where one is enabled and the other is the exact opposite, so when you want to disabile it you add it to 1 and substract from 1.
      The second way is more for the cases that you want the IK always open but you use the curves to disable it. While the opposite is for the cases that you want to enable IK just for one animation

    • @224spiderman
      @224spiderman 7 лет назад

      Thanks for answering :). I'll try to implement it.

  • @Brett4it
    @Brett4it 9 лет назад

    My Character from Mixamo is great, I setup layers and he works perfectly aiming, crouching, running, jumping.
    I wanted to add a aiming weighted system like u have here for his hands rather than feet.
    The code seems to have no effect on character. I added ik pass to base layer, I Named my c# script ikcontrol and used OnAnimatorIK(){} as function name?
    U have any Idea whats wrong ?

    • @Brett4it
      @Brett4it 9 лет назад

      is it because my avatar is generic?

    • @Uselesscommentary
      @Uselesscommentary 9 лет назад

      +Brett Palmer Yeah

    • @RandomDan97
      @RandomDan97 9 лет назад

      +WendaF's Any ideas how to fix this maybe?

    • @Uselesscommentary
      @Uselesscommentary 9 лет назад

      You have to click on the model, select Rig in right panel, and then chanke from generic to humanoid

    • @RandomDan97
      @RandomDan97 9 лет назад

      Thanks! It worked, but now there's the next problem, I set my animations to humanoid as well, but now they're kinda screwed up

  • @pixelissue
    @pixelissue 9 лет назад

    would you be available for a couple of months to help set up our animation pipeline? It would be great to get you involved!

    • @SharpAccent
      @SharpAccent  9 лет назад

      +Pixel Issue The last time I had a couple of months available was like a decade ago hah :P

    • @pixelissue
      @pixelissue 9 лет назад +1

      I know what you mean :D I think I'm putting about 18 hours a day into my game :D No problem if you're not available. Keep up the great work (y)

  • @micezo3655
    @micezo3655 9 лет назад +1

    Thank you for this tutorial :)

  • @GhostEkip
    @GhostEkip 8 лет назад

    Pls UserInput.cs link.

  • @Aki1Kato
    @Aki1Kato 9 лет назад

    hi, i have problems with my model.
    I made IK, and i don't have errors. but IK work so wierd: Bones don't move, when IK is working

    • @Aki1Kato
      @Aki1Kato 9 лет назад

      +Aki Kato oh, np)) Now it works)) Thanks for tutorial))

    • @MsYourMa
      @MsYourMa 6 лет назад

      how did you fix it?

  • @linklovezelda
    @linklovezelda 8 лет назад

    Thank you

  • @closingdealz
    @closingdealz 8 лет назад +1

    is it possible to turn on Foot IK by script

    • @Gann4Games
      @Gann4Games 8 лет назад +1

      What do you mean? Active the script by another script?

  • @GhostEkip
    @GhostEkip 8 лет назад

    I did not work
    MY Code:
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    public class IKHandler : MonoBehaviour {
    Animator anim;
    public float ikWeight = 1;
    public Transform leftIKTarget;
    public Transform rightIKTarget;
    public Transform hintLeft;
    public Transform hintRight;
    Vector3 lFpos;
    Vector3 rFpos;
    Quaternion lFrot;
    Quaternion rFrot;
    float lFWeight;
    float rFWeight;
    Transform leftFoot;
    Transform rightFoot;
    public float offsetY;
    // Use this for initialization
    void Start () {
    anim = GetComponent ();
    leftFoot = anim.GetBoneTransform (HumanBodyBones.LeftFoot);
    rightFoot = anim.GetBoneTransform (HumanBodyBones.RightFoot);
    }
    // Update is called once per frame
    void Update ()
    {
    RaycastHit leftHit;
    RaycastHit rightHit;
    Vector3 lpos = leftFoot.TransformPoint (Vector3.zero);
    Vector3 rpos = rightFoot.TransformPoint (Vector3.zero);
    if(Physics.Raycast(lpos, -Vector3.up, out leftHit, 1))
    {
    lFpos = leftHit.point;
    lFrot = Quaternion.FromToRotation (transform.up, leftHit.normal) * transform.rotation;
    }
    if(Physics.Raycast(rpos, -Vector3.up, out rightHit, 1))
    {
    rFpos = rightHit.point;
    rFrot = Quaternion.FromToRotation (transform.up, rightHit.normal) * transform.rotation;
    }
    }
    void OnAnimatorIK()
    {
    lFWeight = anim.GetFloat ("LeftFoot");
    rFWeight = anim.GetFloat ("RightFoot");
    anim.SetIKPositionWeight (AvatarIKGoal.LeftFoot, lFWeight);
    anim.SetIKPositionWeight (AvatarIKGoal.RightFoot, rFWeight);
    anim.SetIKPosition (AvatarIKGoal.LeftFoot, lFpos + new Vector3(0,offsetY,0));
    anim.SetIKPosition (AvatarIKGoal.RightFoot, rFpos + new Vector3(0,offsetY,0));
    ////////////////////////////////////////////////////////////////////
    anim.SetIKRotationWeight (AvatarIKGoal.LeftFoot, lFWeight);
    anim.SetIKRotationWeight (AvatarIKGoal.RightFoot, rFWeight);
    anim.SetIKRotation(AvatarIKGoal.LeftFoot, lFrot);
    anim.SetIKRotation(AvatarIKGoal.RightFoot, rFrot);
    ////////////////////////////////////////////////////////////////////
    /*anim.SetIKHintPositionWeight (AvatarIKHint.LeftKnee, ikWeight);
    anim.SetIKHintPositionWeight (AvatarIKHint.RightKnee, ikWeight);
    anim.SetIKHintPosition (AvatarIKHint.LeftKnee, hintLeft.position);
    anim.SetIKHintPosition (AvatarIKHint.RightKnee, hintRight.position);*/
    }
    }

  • @bigbang559
    @bigbang559 8 лет назад

    your script in this tutorial not working to me !! Help me .. i have unity 5.3.2f1

    • @SharpAccent
      @SharpAccent  8 лет назад

      You need to have a humanoid character and check IK Pass on the animator for the IK to work

  • @zyx8463
    @zyx8463 7 лет назад

    hey man great tutorial but my feet are both going to the middle/they look like im trying to balance my feet standing together

    • @ZhenkNZ
      @ZhenkNZ 7 лет назад

      Had the same problem, fixed it by adding these two lines in OnAnimatorIK()
      lpos = anim.GetIKPosition(AvatarIKGoal.LeftFoot);
      rpos = anim.GetIKPosition(AvatarIKGoal.RightFoot);
      Think it is caused by models we are using.
      @Sharp_Accent Thank you so much!!!

  • @MeMoshRocks
    @MeMoshRocks 8 лет назад

    How would you go about doing this on a generic rig (non-humanoid).

    • @SharpAccent
      @SharpAccent  7 лет назад +1

      You need to make a custom ik solution, there's a few ways to do that and I did on in the past (in Unity 4). There's also a few free ones out there and of course paid ones.

  • @cristiandelolmo9387
    @cristiandelolmo9387 7 лет назад +1

    are you the same person of the chanel sharpstance?

  • @theknownunknown3904
    @theknownunknown3904 7 лет назад +3

    why aren't the knees bending in 32:05 for me???

    • @Kees-o
      @Kees-o 6 лет назад

      I'm running into the same issue...Have you got a solution yet? :)

  • @rafaelcorrea7959
    @rafaelcorrea7959 6 лет назад

    Why use -Vector3.up instead of Vector3.down?

  • @oldschoolguy3319
    @oldschoolguy3319 8 лет назад

    how do i acces the spine of the avatar?

    • @SharpAccent
      @SharpAccent  8 лет назад

      With this docs.unity3d.com/ScriptReference/Animator.GetBoneTransform.html if it doesn't include the bone you want you can hardcode, like get the chest, then get the parent of the chest etc.

  • @flooblybub
    @flooblybub 9 лет назад +1

    5 minutes in, 4 compiler errors... damn it.
    UnityEngine.Animator does not contain a definition for SetIKPositionWeight or SetIKPosistion.
    What am I doing wrong?

  • @kidagine
    @kidagine 5 лет назад +1

    ευχαριστώ πολύ φίλος

  • @jjr5550
    @jjr5550 9 лет назад

    Can bones be manually rotated from script?

    • @SharpAccent
      @SharpAccent  9 лет назад

      Jj R Yes, but you'll have to do it inside LateUpdate() see the custom IK video for more info

    • @jjr5550
      @jjr5550 9 лет назад

      I meant rotating the bone in game in the build. Is there a way?

    • @johncarlogamboa7331
      @johncarlogamboa7331 9 лет назад

      Jj R Yes. As he mentioned, all rotations and physics codes are to be updated on LateUpdate(). You wouldn't wanna update those rotations every time. You'd only want them to update when everything else is drawn.
      Rotating a bone is just like rotating any cube or capsule too. They are just transforms too.

    • @SharpAccent
      @SharpAccent  9 лет назад

      Physics must go inside FixedUpdate() not LateUpdate(), because we have animations on our character in every frame they reset the position of every bone to match that of the animations, LateUpdate() runs after the animator so if you won't to change the position of a bone you need to do it there, otherwise you will be trying to manipulate the transform of the bone on the same frame so you won't have good results if any

    • @johncarlogamboa7331
      @johncarlogamboa7331 9 лет назад

      I see. My bad, thanks. :D

  • @farhanhakim2189
    @farhanhakim2189 3 года назад

    I love this channel
    But can you please add automatic English subtitle? I don't understand what are you saying

    • @SharpAccent
      @SharpAccent  3 года назад

      It's not available for videos longer than 10 minutes

  • @powersx2508
    @powersx2508 5 лет назад

    where can i take assets ?

    • @SharpAccent
      @SharpAccent  5 лет назад

      Asset store :)

    • @powersx2508
      @powersx2508 5 лет назад

      @@SharpAccent what is the asset's name? Built in IK?

  • @alnajjar6457
    @alnajjar6457 8 лет назад

    thanks for this video every thing is working Except my elbow can you tell me how i can fix it thanks again :)

  • @fenrirXVIII
    @fenrirXVIII 8 лет назад

    Thank you so so much! U re so awesome!

  • @luhardash
    @luhardash 9 лет назад

    Does this work on Unity Free version?

  • @alnajjar6457
    @alnajjar6457 8 лет назад

    Is this work now?

  • @pixeldev5221
    @pixeldev5221 9 лет назад

    Can you make a Download Link ?

    • @SharpAccent
      @SharpAccent  9 лет назад +1

      PixelDev The controller is available on the Advanced Character Controller video. All other scripts are available as a reward for my Patreon backers :)

  • @McMidas97
    @McMidas97 8 лет назад

    Hi. Can you make a tutorial with eye blinking? Gia sou

    • @SharpAccent
      @SharpAccent  8 лет назад +2

      Eye blinking is done with blend shapes usually, it's more of modelling rather than scripting

  • @nearyou7232
    @nearyou7232 8 лет назад

    Hey guys, got a problem... my IK just doesnt work, got the scripts exactly as you but it just doesnt start.. Not sure why, i use Networking to spawn my character on map etc , but IK shouldnt have problems with that right? It looks like it just doesnt start..Help?

    • @SharpAccent
      @SharpAccent  8 лет назад

      Tick IK pass on the animator (on all layers that are affected), make sure you add weight to the IK, that's all there is to it. Of course assign targets too

    • @nearyou7232
      @nearyou7232 8 лет назад +2

      Thanks for your quick response, my mistake was that my character prefabs rig was Generic not Humanoid. That's kinda embrassing but i got it now, but thanks for help :) I'm making a game for engineering degree and when i'm done i will make some videos of it :) Will past link here if u are interested :) Thanks again.

    • @nearyou7232
      @nearyou7232 8 лет назад

      Ok, i have tried doing your tutorial like 3 times, there is always something wrong, is it because im using Personal edition? My mixamo character just doesnt want to cooperate with IK , i mean it works but it looks weird :/

    • @SharpAccent
      @SharpAccent  8 лет назад

      No I use personal edition too. It depends what you mean by weird. It's all about the values you give to it if the IK works at least

    • @nearyou7232
      @nearyou7232 8 лет назад

      Hmmm.. The legs just sticks together and they dont make that "step" like your character, i tried doing something with hands but it just didnt work. I thought maybe there is something with my unity version or mixamo character , didnt have time but today i will try to do it with standard charavter asset to check if there lies the problem.

  • @creationsmaxo
    @creationsmaxo 9 лет назад +10

    It might be due to randomness... but as I was skipping most of the video to see what this is all about, (Instead of wasting 1h16 of my time in case I already know what it's about) wherever I clicked on the time bar... it almost always started with a sentence that seems to be overly used in this video :
    "So..."
    "So..."
    "So..."
    Makes me remember of an old teacher I had in high school would could say the exact sentence "This is really important. Really." over 40 times in a single hours. XD
    Note. This is not a rant. Only a opinion about something I noticed. ;)

    • @SharpAccent
      @SharpAccent  9 лет назад +4

      +Creations Maxo (Maxime Bolduc) So.. yeah I noticed I do that a lot hah

    • @jamboyChip
      @jamboyChip 7 лет назад

      Creations Maxo "So" isn't a sentence...

    • @terpine8984
      @terpine8984 7 лет назад

      Joel H but the scentence starts with it

    • @craigpage3980
      @craigpage3980 7 лет назад

      So? :)

  • @khoroshoigra8388
    @khoroshoigra8388 6 лет назад

    UnassignedReferenceException: The variable lookPos of GunCarryingRifle has not been assigned

  • @rabiehaddad2360
    @rabiehaddad2360 8 лет назад

    they said cant find avatarik goal

  • @aq3dletsplay230
    @aq3dletsplay230 8 лет назад

    nice!

  • @xCrOaTiEnSniPZzx
    @xCrOaTiEnSniPZzx 7 лет назад

    Does it work in 2D? :P

  • @christobanistan8887
    @christobanistan8887 5 лет назад

    IK?

  • @quakenxt
    @quakenxt 8 лет назад

    48:24 OH NO

  • @5252emre
    @5252emre 4 года назад

    foot and feet

    • @SharpAccent
      @SharpAccent  4 года назад

      Hands and hends

    • @5252emre
      @5252emre 4 года назад

      @@SharpAccent haha englsh is funny. my english is brokn but u can explain good and clear its easy to understand for me.