Ejemplo n.º 1
0
    /*
     * converts spatial information to joint relative rotations
     * -1 for right, 1 for left
     */
    Quaternion _convertLocToRot(BodyJoint.JointType jType, BodyJoint.JointType jChild, Quaternion parentAtt, float dir)
    {
        Vector3    tForward = Quaternion.AngleAxis(180, Vector3.up) * (getJointLoc(jChild) - getJointLoc(jType));
        Vector3    tRight   = -Vector3.right;
        Vector3    tUp      = Vector3.Cross(tRight.normalized, tForward.normalized);
        Quaternion tAtt     = Quaternion.LookRotation(tForward.normalized, tUp.normalized) * Quaternion.AngleAxis(dir * 90, Vector3.up);

        setJointRot(jType, Quaternion.Inverse(parentAtt) * tAtt);
        return(tAtt);
    }
Ejemplo n.º 2
0
 public Quaternion setJointRot(BodyJoint.JointType type, Quaternion rot)
 {
     joint_rotations[(int)type] = rot;
     return(rot);
 }
Ejemplo n.º 3
0
 public Vector3 getJointLoc(BodyJoint.JointType type)
 {
     return(joint_locations[(int)type]);
 }
Ejemplo n.º 4
0
 public Quaternion getJointRot(BodyJoint.JointType type)
 {
     return((Quaternion)joint_rotations[(int)type]);
 }