I am interested in moving a ragdoll character only using Forces.
I have the ragdoll setup already, all the joints and colliders are in place, so are the rigidbodies with their own masses.
I am aware that usually the method of using ragdolls is having 2 instances of the same character, one ragdoll and one not a ragdoll, and swapping between them as neccesary. However my usecase is different, I want to have only the ragdoll version and obtain some sort of movement using forces applied to it.
So far I have seen and used the AddForce method inside the fixedupdate method, on each rigidbody which is a child of my created ragdoll. However this didn't take me too far, it would seem the character moves erratically and with a sever Parkinson effect. AddTorque didn't help very much either. I imagine there needs to be a limitation to the quantum of forces applied, as to not exceed the human capacities to move with a regular speed. Also I am not sure if the place to implement this is fixedupdate, since the forces get reapplied over and over again, increasing my character's total velocity. Perhaps a higher drag value could help here?
Here is a short snippet of what i tried so far.
Vector3 torque;
for (int i = 0; i < allchildren.Length; i++) //all limbs head torso etc
{
var rb = allchildren[i].GetComponent<Rigidbody>();
if (rb)
{
torque.x = Random.Range(-10, 10);
torque.y = Random.Range(-10, 10);
torque.z = Random.Range(-10, 10);
rb.AddTorque(torque);
rb.AddForce(new Vector3(1, 0, 1) * Random.Range(0f, 0.1f), ForceMode.Force);
}
}
If someone has any ideas that could point me into the right direction, I would be grateful.