AeleaS Omer

[SOLVED] How to add time for IK ?

Hi.

I was following IK tutorial on unity page. 

https://docs.unity3d.com/Manual/InverseKinematics.html

Where the hand touch object and head look at it. I need to know how to add speed time for this movement. Speed time for the head and hand when "ikActive" is active or deactivated.


  • crew

    Well it depends what you're trying to do. If you wanted the character to "grab" an object when they are within range you could use a simple trigger When you're in the trigger the weight for that IK part of the body will be 1, when not in the trigger it goes back down to 0. 

    If you wanted to slowly increment the movement with IK you could slowly increase the weight over time. Here is some pseudo code to better understand it:

    while(ikWeight< 1)
    {
    currentWeight += Time.deltaTime;
    ikWeight = currentWeight/ 1;
    
    
    }
    


    Essentially just going through and increasing your IK weight over time. Since the weight value maxes out at 1 you'll utilize a fraction. Time.deltaTime will ensure that it slowly increments. I haven't tested the above code, but it'll give you an idea of how it would work. You could also subtract by Time.deltaTime as well to reverse it. 



  • jgonzalez , you right. 

    I want to control the movement speed of IK.  Now I can adjust you script to fit my own.

    Thank you again JG.