LookAtUp() public static méthode

Get quaternion with rotation as Y axis towards target as close as z parameter as possible
public static LookAtUp ( OpenTK.Vector3 source, OpenTK.Vector3 target, OpenTK.Vector3 z ) : Quaternion
source OpenTK.Vector3 The source position vector to look from
target OpenTK.Vector3
z OpenTK.Vector3
Résultat Quaternion
        private void Neck(Bone b)
        {
            Vector3 up  = Vector3.Transform(UnitY, ChestOrientation);
            Vector3 pos = SternumClavicle + up * BodyData.SpineLength * 2;

            b.Pos         = pos;
            b.Orientation = QuaternionHelper2.LookAtUp(pos, Head, ChestForward);
        }
        private void SpineRoot(Bone b)
        {
            Vector3 target = !Spine1.IsNaN() ? Spine1 : SternumClavicle;
            Vector3 pos    = markers[m.bodyBase] + HipForward * BodyData.MarkerToSpineDist;

            b.Pos         = pos;
            b.Orientation = QuaternionHelper2.LookAtUp(pos, target, HipForward);
        }
 private void GetAnkleRight(Bone b)
 {
     b.Pos = AnkleRight;
     if (markers[m.rightInnerAnkle].IsNaN())
     {
         Vector3 up = KneeRight - AnkleRight;
         b.Orientation = QuaternionHelper2.LookAtUp(AnkleRight, FootBaseRight, up);
     }
     else
     {
         Vector3 right = markers[m.rightOuterAnkle] - markers[m.rightInnerAnkle];
         b.Orientation = QuaternionHelper2.LookAtRight(AnkleRight, FootBaseRight, right);
     }
 }
Exemple #4
0
 /// <summary>
 /// The function applied to each bone in the skeleton
 /// </summary>
 /// <param name="bone">The skeleton, a tree of bones</param>
 private void TraversFunc(TreeNode <Bone> bone)
 {
     if (!bone.Data.Exists)
     {
         if (bone.IsRoot || bone.Parent.IsRoot)
         {
             return;
         }
         if (
             bone.Data.Name.Equals(Joint.CLAVICLE_L) ||
             bone.Data.Name.Equals(Joint.CLAVICLE_R) ||
             bone.Data.Name.Equals(Joint.TRAP_L) ||
             bone.Data.Name.Equals(Joint.TRAP_R))
         {
             bone.Data.Pos         = new Vector3(bone.Parent.Data.Pos);
             bone.Data.Orientation = QuaternionHelper2.LookAtUp(
                 bone.Data.Pos,
                 bone.Children.First().Data.Pos,
                 bone.Parent.Data.GetZAxis());
             return;
         }
         MissingJoint(bone);
     }
 }
 private void GetHandRight(Bone b)
 {
     b.Pos         = markers[m.rightHand];
     b.Orientation = QuaternionHelper2.LookAtUp(markers[m.rightHand], markers[m.rightIndex], LowerArmForwardRight);
 }
 private void GetTrapRight(Bone b)
 {
     b.Pos         = WristRight;
     b.Orientation = QuaternionHelper2.LookAtUp(WristRight, markers[m.rightThumb], LowerArmForwardRight);
 }
 private void GetTrapLeft(Bone b)
 {
     b.Pos         = WristLeft;
     b.Orientation = QuaternionHelper2.LookAtUp(WristLeft, markers[m.leftThumb], LowerArmForwardLeft);
 }
 private void GetLowerArmRight(Bone b)
 {
     b.Pos         = ElbowRight;
     b.Orientation = QuaternionHelper2.LookAtUp(ElbowRight, WristRight, LowerArmForwardRight);
 }
 private void GetLowerArmLeft(Bone b)
 {
     b.Pos         = ElbowLeft;
     b.Orientation = QuaternionHelper2.LookAtUp(ElbowLeft, WristLeft, LowerArmForwardLeft);
 }
 private void GetShoulderRight(Bone b)
 {
     b.Pos         = SternumClavicle;
     b.Orientation = QuaternionHelper2.LookAtUp(SternumClavicle, ShoulderRight, ChestForward);
 }
 private void GetFootBaseRight(Bone b)
 {
     b.Pos         = FootBaseRight;
     b.Orientation = QuaternionHelper2.LookAtUp(b.Pos, markers[m.rightToe2], LowerLegUpRight);
 }
 private void GetFootBaseLeft(Bone b)
 {
     b.Pos         = FootBaseLeft;
     b.Orientation = QuaternionHelper2.LookAtUp(b.Pos, markers[m.leftToe2], LowerLegUpLeft);
 }