I have a ragdoll, but when it moves it crawls like a reptile, and acts like a ragdoll off course, but with movement.
How can I move only one part (rigidbody) of the ragdoll and make the rest follow it?
I have this section of the script:
ragdoll = transform.FindChild("Armature") as Transform;
rb = ragdoll.GetComponentInChildren(typeof(Rigidbody)) as Rigidbody;
TP_Controller.rb.velocity = MoveVector;
Here is a video of the problem:
I do not know if it will be useful for you 4 years later but, I think I have the solution…
What I did is create an empty object and when the player is ragdolled, simply put the drag parameter of the rigidbody exactly as the mass and use the function of MovePosition of the Rigidbody class…
Here is the code I wrote for the rigidbody part you want to drag…
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Drag : MonoBehaviour {
public GameObject dragIK;
public bool drag = false;
void Update () {
if (drag) {
GetComponent<Rigidbody> ().drag = GetComponent<Rigidbody> ().mass;
GetComponent<Rigidbody> ().MovePosition (dragIK.transform.position);
} else {
GetComponent<Rigidbody> ().drag = 0;
}
}
}
Hope it helps…