RevoluteJoints and Limits for Ragdoll
Posted: Mon Nov 12, 2012 3:24 am
Hi again,
I am now trying to improve my skeleton so that it behaves more like a real human skeleton, and one of my first steps is trying to use revolute joints for the elbows and knees.
I have managed to get knee joints working with the joint rotating around the proper axis, however I have not been able to figure out how to get the rotation limits to work. No matter what values I use for MaximumAngle and MinimumAngle I am consistently seeing backward rotation on the knee from the starting angle.
So my questions are:
1. The ragdoll begins in bindpose, with the thigh and shin bones lined up and on top of each other. Since this how the ragdoll is setup when its joints are attached, does this orientation represent a 0 degree angle?
2. Am I doing something inherently wrong when I am creating the joint and setting up the limits?
I am now trying to improve my skeleton so that it behaves more like a real human skeleton, and one of my first steps is trying to use revolute joints for the elbows and knees.
I have managed to get knee joints working with the joint rotating around the proper axis, however I have not been able to figure out how to get the rotation limits to work. No matter what values I use for MaximumAngle and MinimumAngle I am consistently seeing backward rotation on the knee from the starting angle.
So my questions are:
1. The ragdoll begins in bindpose, with the thigh and shin bones lined up and on top of each other. Since this how the ragdoll is setup when its joints are attached, does this orientation represent a 0 degree angle?
2. Am I doing something inherently wrong when I am creating the joint and setting up the limits?
Code: Select all
//Connect the upper leg to the lower leg
revJoint = new RevoluteJoint(upperLimb, lowerLimb, upperLimb.Position +
new Vector3(0, -1f, 0), new Vector3(1, 0, 0));
revJoint.Motor.IsActive = false;
revJoint.Limit.MaxCorrectiveVelocity = .5f;
revJoint.Limit.MaximumAngle = 0;
revJoint.Limit.MinimumAngle = (float) Math.PI/2;
Add(revJoint);