Search Unity

How to do you Lerp Ragdoll from raggdoll to mecanin?

Discussion in 'Physics' started by pan-master, May 18, 2018.

  1. pan-master

    pan-master

    Joined:
    Nov 11, 2013
    Posts:
    127
    Iam trying to Lerp all Ragdolled Transforms to Mecain Positions,However it does not work, Any ideas?
    Code (CSharp):
    1.  
    2.             foreach (Transform Objectt in RagdallObjects)
    3.             {
    4.                 if (Objectt.GetComponent<Rigidbody>() != null) { Objectt.GetComponent<Rigidbody>().isKinematic = true; }
    5.                 Objectt.transform.localPosition = Vector3.Lerp(RagdallObjects[i].localPosition, AnimatedObjects[i].localPosition, 0.5f * Time.deltaTime);
    6.                 Objectt.transform.localEulerAngles= Vector3.Lerp(RagdallObjects[i].localEulerAngles, AnimatedObjects[i].localEulerAngles, 0.5f * Time.deltaTime);
    7.                 i++;
    8.                 if (i >= RagdallObjects.Length) { i = 0; }
    9.             }
     
  2. dibdab

    dibdab

    Joined:
    Jul 5, 2011
    Posts:
    976