public void BeginHand(byte[] arrHand) { Enable = true; hand_ = LeapHandData.Deserialize(arrHand); InitHand(); BeginHand(); UpdateHand(); }
void Update() { hand = handModel.GetLeapHand(); if (hand != null) { transform.localPosition = hand.PalmPosition.ToVector3(); transform.localRotation = hand.Rotation.ToQuaternion(); } }
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); } }
public static byte[] Serialize(Hand hand) { if (hand == null) { return(null); } NetHand nethand = new NetHand(hand); return(Serialize(nethand)); }
// 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)); } } }
public void SetLeapHand(byte[] arrHand) { if (hand_ == null) { hand_ = LeapHandData.Deserialize(arrHand); InitHand(); BeginHand(); UpdateHand(); } else { hand_ = LeapHandData.Deserialize(arrHand); UpdateHand(); } }
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); }
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); }
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); }
public void FinishHand() { isTracked = false; hand_ = null; Enable = false; }
public void SetLeapHand(byte[] arrHand) { hand_ = LeapHandData.Deserialize(arrHand); UpdateHand(); }