Unity 5 Tutorial The Built-In IK System

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 ธ.ค. 2024

ความคิดเห็น • 231

  • @IoanKatalinn
    @IoanKatalinn 9 ปีที่แล้ว +102

    48:20 - everything you need to know

    • @SharpAccent
      @SharpAccent  9 ปีที่แล้ว +5

      +Ioan Katalin :P

    • @richc2419
      @richc2419 6 ปีที่แล้ว +1

      Ha ha ha

    • @abenedict85
      @abenedict85 4 ปีที่แล้ว

      oh no! leave alone to me!

  • @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)

  • @mandisaw
    @mandisaw 8 หลายเดือนก่อน +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 😂)

  • @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

  • @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.

  • @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

  • @Vyebrows
    @Vyebrows 9 ปีที่แล้ว +5

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

  • @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)

  • @joe6949
    @joe6949 5 ปีที่แล้ว +1

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

  • @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

  • @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!!

  • @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 ?

  • @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 7 ปีที่แล้ว +6

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

  • @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 8 หลายเดือนก่อน

      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.

  • @RigvedDeshpandeArt
    @RigvedDeshpandeArt 9 ปีที่แล้ว +3

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

    • @SharpAccent
      @SharpAccent  9 ปีที่แล้ว +1

      +Rigved Deshpande =)

  • @voter1412
    @voter1412 5 ปีที่แล้ว

    This helped me with some problems I had. Thanks!

  • @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!

  • @MalbersAnimations
    @MalbersAnimations 8 ปีที่แล้ว +1

    Simply Amazing!!

  • @neetshonen
    @neetshonen 4 ปีที่แล้ว

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

  • @Elledan3101
    @Elledan3101 8 ปีที่แล้ว

    thank you! thank you very much!
    the best video tutorial on TH-cam 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 :)

  • @RandomDan97
    @RandomDan97 9 ปีที่แล้ว +3

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

  • @RoffeDH
    @RoffeDH 7 ปีที่แล้ว

    Excellent tutorial! Thank you so much!

  • @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!

  • @jupitersky
    @jupitersky 7 ปีที่แล้ว

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

  • @inderdeepsingh2378
    @inderdeepsingh2378 8 ปีที่แล้ว

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

  • @lirantwik
    @lirantwik 8 ปีที่แล้ว

    really great stuff , thank you!

  • @user-rc1sn7du5y
    @user-rc1sn7du5y 8 ปีที่แล้ว

    Might make a video like climbing?

  • @brian10508
    @brian10508 7 ปีที่แล้ว

    extremely useful, thanks a lot!

  • @uliveulearnandregret
    @uliveulearnandregret 5 ปีที่แล้ว

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

  • @kingdaygaming8461
    @kingdaygaming8461 4 ปีที่แล้ว

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

  • @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!

  • @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

  • @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?

  • @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

  • @harrybritten1880
    @harrybritten1880 7 ปีที่แล้ว

    Great tutorial thanks

  • @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

  • @yacinearab7243
    @yacinearab7243 2 ปีที่แล้ว +1

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

  • @DorothyJeanThompson
    @DorothyJeanThompson 8 ปีที่แล้ว

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

  • @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

  • @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

  • @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 th-cam.com/video/D1Cb6EzeEPY/w-d-xo.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!

  • @micezo3655
    @micezo3655 9 ปีที่แล้ว +1

    Thank you for this tutorial :)

    • @SharpAccent
      @SharpAccent  9 ปีที่แล้ว

      michal ezo You're welcome :)

  • @filiprudzinski4490
    @filiprudzinski4490 6 ปีที่แล้ว

    Wonderful tutorial. But why didin't post code?

  • @mclanebacsi
    @mclanebacsi 7 ปีที่แล้ว

    What does the "camera holder" contain?

  • @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? :)

  • @mikethegamedev
    @mikethegamedev 3 ปีที่แล้ว

    Such an childhood that i watch

  • @lostdeeper
    @lostdeeper 4 ปีที่แล้ว

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

  • @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.

  • @cristiandelolmo9387
    @cristiandelolmo9387 7 ปีที่แล้ว +1

    are you the same person of the chanel sharpstance?

  • @111shooter1111
    @111shooter1111 8 ปีที่แล้ว

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

  • @vincentgiron2831
    @vincentgiron2831 9 ปีที่แล้ว

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

  • @2rajjjkjjkkjj
    @2rajjjkjjkkjj 7 ปีที่แล้ว

    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  7 ปีที่แล้ว +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 7 ปีที่แล้ว

      Thanks a lot. Its really helpful.

  • @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!!!

  • @rasengan720
    @rasengan720 8 ปีที่แล้ว

    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  8 ปีที่แล้ว

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

    • @SharpAccent
      @SharpAccent  8 ปีที่แล้ว

      +C Sharp Accent Tutorials *can't imagine

    • @rasengan720
      @rasengan720 8 ปีที่แล้ว

      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  8 ปีที่แล้ว

      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 8 ปีที่แล้ว

      haha true that!

  • @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?

  • @GhostEkip
    @GhostEkip 8 ปีที่แล้ว

    Pls UserInput.cs link.

  • @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!!!

  • @jjr5550
    @jjr5550 9 ปีที่แล้ว

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

  • @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

  • @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

  • @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...

  • @kidagine
    @kidagine 4 ปีที่แล้ว +1

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

  • @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

  • @rafaelcorrea7959
    @rafaelcorrea7959 6 ปีที่แล้ว

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

  • @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?

  • @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

  • @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?

    • @smartlessgamer8696
      @smartlessgamer8696 8 ปีที่แล้ว

      +flooblybub You need pro version of unity :P

    • @SharpAccent
      @SharpAccent  8 ปีที่แล้ว

      +SmartLessGamer not really you don't if you use Unity 5 :P

    • @smartlessgamer8696
      @smartlessgamer8696 8 ปีที่แล้ว

      Oh good :)

  • @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

  • @Aki1Kato
    @Aki1Kato 8 ปีที่แล้ว

    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 8 ปีที่แล้ว

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

    • @MsYourMa
      @MsYourMa 6 ปีที่แล้ว

      how did you fix it?

  • @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

  • @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.

  • @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)

  • @MeMoshRocks
    @MeMoshRocks 7 ปีที่แล้ว

    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.

  • @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.

  • @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?

  • @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.

  • @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

  • @fenrirXVIII
    @fenrirXVIII 8 ปีที่แล้ว

    Thank you so so much! U re so awesome!

  • @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 :)

  • @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

  • @linklovezelda
    @linklovezelda 8 ปีที่แล้ว

    Thank you

  • @luhardash
    @luhardash 9 ปีที่แล้ว

    Does this work on Unity Free version?

    • @SharpAccent
      @SharpAccent  9 ปีที่แล้ว

      +Rahul Das Unity 5 yes

  • @alnajjar6457
    @alnajjar6457 8 ปีที่แล้ว

    Is this work now?

  • @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

  • @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? :)

  • @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);*/
    }
    }

  • @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 :)

  • @aq3dletsplay230
    @aq3dletsplay230 8 ปีที่แล้ว

    nice!

  • @khoroshoigra8388
    @khoroshoigra8388 6 ปีที่แล้ว

    UnassignedReferenceException: The variable lookPos of GunCarryingRifle has not been assigned

  • @xCrOaTiEnSniPZzx
    @xCrOaTiEnSniPZzx 7 ปีที่แล้ว

    Does it work in 2D? :P

  • @rabiehaddad2360
    @rabiehaddad2360 8 ปีที่แล้ว

    they said cant find avatarik goal

  • @christobanistan8887
    @christobanistan8887 5 ปีที่แล้ว

    IK?

  • @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.

  • @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.