Limb updating?

Hi,
I was wondering if there is a special command I can use in Javascript that would make it so that if I set the positioning of something like a hand on a character to a vectored spot in world space, that all the other connecting limbs of that character would automatically reattach itself to the hand that I move (like the lower arm with all its rotations and positionings in place).

So far, If I use a script to move a limb on a character to a different world position, only all the connecting triangles to that limb that are also from from the connecting limb scale themselves and get reattached to the moved limb, when instead, I would like the whole entire attaching limb itself to reattach by rotating and moving according to where the new world position is, and not just the connecting triangles. How do I do that? Also, is there a way to calculate if the new world position of the limb that I move is within the limitations of the limb and if not, to positing itself to the maximum stretch length closest to the point in world space I try to move the limb to?

Thank you,
Michael S. Lowe

I would suggest going about this differently. Get the difference in position between the hand and it’s target location

var positionDifference = target.position - hand.position;

then move your whole character that distance.

character.position += positionDifference;

something like that.

Yeah.
Groovy.

Yes but that would only effect the positioning of the whole entire character where if I move one limb, the whole character moves along with the limb. I do not wish to drag the whole entire character itself based on the movement of one limb. I want the physics of all the connecting limbs to stay connected to the limb that got moved (where all the connecting limbs will rotate according to the physics behind the attachment(s)).

You probably want to use CharacterJoint s and move the target bone “slowly” to the target position (speed depending on how messed-up you want to allow the character to be during movement).

You’re talking about inverse kinematics. There isn’t a command to do that, but if you string enough code together, you can accomplish it. You can probably get some ideas by looking at the Locomotion system for Unity.

–Eric

Thank you Eric, but I thought the Locomotive program was specifically designed to make the physics behind the animations of characters align with any given slope. There SHOULD be a special way to ‘hinge joint’ two limbs on a given character, but I found that when I tried to do that, the rotations and positions went crazy. Is there a way I could use the Locomotive program to generate inverse kinematics?

Thank you,
Michael S. Lowe

I didn’t mean that you would actually use Locomotion in this case, I mean that you could look at the code, which might help to see how inverse kinematics are done. Programmatically putting feet on slopes and having the legs follow properly is the same thing as programmatically putting a hand in a certain spot and having the arm follow properly.

–Eric