コード例 #1
0
ファイル: LeapHand.cs プロジェクト: wsycarlos/OrionServer
 public void BeginHand(byte[] arrHand)
 {
     Enable = true;
     hand_  = LeapHandData.Deserialize(arrHand);
     InitHand();
     BeginHand();
     UpdateHand();
 }
コード例 #2
0
 void Update()
 {
     hand = handModel.GetLeapHand();
     if (hand != null)
     {
         transform.localPosition = hand.PalmPosition.ToVector3();
         transform.localRotation = hand.Rotation.ToQuaternion();
     }
 }
コード例 #3
0
 void Start()
 {
     hand = handModel.GetLeapHand();
     if (hand != null)
     {
         transform.localPosition = hand.PalmPosition.ToVector3();
         transform.localRotation = hand.Rotation.ToQuaternion();
         transform.localScale    = new Vector3(1f, 1f, 1f);
     }
 }
コード例 #4
0
    public static byte[] Serialize(Hand hand)
    {
        if (hand == null)
        {
            return(null);
        }

        NetHand nethand = new NetHand(hand);

        return(Serialize(nethand));
    }
コード例 #5
0
 // Convert a byte array to an Object
 public static NetHand Deserialize(byte[] arr)
 {
     if (arr == null)
     {
         return(null);
     }
     using (MemoryStream stream = new MemoryStream(arr))
     {
         using (BinaryReader reader = new BinaryReader(stream))
         {
             return(NetHand.Read(reader));
         }
     }
 }
コード例 #6
0
ファイル: LeapHand.cs プロジェクト: wsycarlos/OrionClient
 public void SetLeapHand(byte[] arrHand)
 {
     if (hand_ == null)
     {
         hand_ = LeapHandData.Deserialize(arrHand);
         InitHand();
         BeginHand();
         UpdateHand();
     }
     else
     {
         hand_ = LeapHandData.Deserialize(arrHand);
         UpdateHand();
     }
 }
コード例 #7
0
 public static void Write(BinaryWriter w, NetHand h)
 {
     if (h.Fingers == null || h.Fingers.Count == 0)
     {
         w.Write(0);
     }
     else
     {
         w.Write(h.Fingers.Count);
         foreach (NetFinger f in h.Fingers)
         {
             NetFinger.Write(w, f);
         }
     }
     w.Write(h.IsLeft);
     NetVector.Write(w, h.PalmPosition);
     NetVector.Write(w, h.XBasis);
 }
コード例 #8
0
    public static NetHand Read(BinaryReader r)
    {
        NetHand h     = new NetHand();
        int     count = r.ReadInt32();

        h.Fingers = new List <NetFinger>();
        if (count > 0)
        {
            for (int i = 0; i < count; i++)
            {
                NetFinger f = NetFinger.Read(r);
                h.Fingers.Add(f);
            }
        }
        h.IsLeft       = r.ReadBoolean();
        h.PalmPosition = NetVector.Read(r);
        h.XBasis       = NetVector.Read(r);

        return(h);
    }
コード例 #9
0
    public static byte[] Serialize(NetHand hand)
    {
        if (hand == null)
        {
            return(null);
        }

        byte[] data = null;
        using (MemoryStream stream = new MemoryStream())
        {
            using (BinaryWriter writer = new BinaryWriter(stream))
            {
                NetHand.Write(writer, hand);

                stream.Position = 0;
                data            = new byte[stream.Length];
                stream.Read(data, 0, data.Length);
            }
        }
        return(data);
    }
コード例 #10
0
ファイル: LeapHand.cs プロジェクト: wsycarlos/OrionServer
 public void FinishHand()
 {
     isTracked = false;
     hand_     = null;
     Enable    = false;
 }
コード例 #11
0
ファイル: LeapHand.cs プロジェクト: wsycarlos/OrionServer
 public void SetLeapHand(byte[] arrHand)
 {
     hand_ = LeapHandData.Deserialize(arrHand);
     UpdateHand();
 }