Pose matching with direct angular velocity control
Posted: Sun May 16, 2010 6:26 pm
I am working on animation for my new game, more specifically I am working on partial ragdolls. For example, in a walking animation I can set the character's arms to be only partially kinematic so that they swing a little when changing direction. Currently I am using btHingeConstraint and Generic6DofConstraint, and their corresponding rotational motors.
However, I am having trouble getting the parameters right to make it look natural, largely because the motor parameters (target angular velocity and maximum motor force) are secondary values for what I really need.
Let's consider a simple hinge joint like the elbow, which is currently bent at 90 degrees, and the target angle is 70 degrees. Right now I then set the motor to a target angular velocity of -20 degrees per timestep, and the maximum force to a high amount. This successfully achieves 100% pose matching. Similarly, I can set the maximum force to 0 to get 0% pose matching, and leave the arm completely limp.
The hard part is when I want something like 50% pose matching. I would like this to work like an angular spring that adds 50% of the angular difference to the angular velocity every timestep. However, I don't know how to set this up using the exposed motor parameters (target velocity and maximum motor force).
I suppose I could do it by setting the target velocity to + or - infinity and setting the max motor force based on torque = inertia tensor * angular acceleration, and then modulate it by the amount of pose matching I want. Surely there is a more direct way to do this though?
However, I am having trouble getting the parameters right to make it look natural, largely because the motor parameters (target angular velocity and maximum motor force) are secondary values for what I really need.
Let's consider a simple hinge joint like the elbow, which is currently bent at 90 degrees, and the target angle is 70 degrees. Right now I then set the motor to a target angular velocity of -20 degrees per timestep, and the maximum force to a high amount. This successfully achieves 100% pose matching. Similarly, I can set the maximum force to 0 to get 0% pose matching, and leave the arm completely limp.
The hard part is when I want something like 50% pose matching. I would like this to work like an angular spring that adds 50% of the angular difference to the angular velocity every timestep. However, I don't know how to set this up using the exposed motor parameters (target velocity and maximum motor force).
I suppose I could do it by setting the target velocity to + or - infinity and setting the max motor force based on torque = inertia tensor * angular acceleration, and then modulate it by the amount of pose matching I want. Surely there is a more direct way to do this though?