public void OnHandUpdate(IHand hand) { if (!hand.IsPresent()) { HandNotNearKnob(); return; } AddTrail(hand); var closest = knobs.FindClosestTo(hand.Centre()); if (closest == null) { HandNotNearKnob(); return; } HandNearKnob(closest); }
public string OnHandUpdate(IHand hand) { if (!hand.IsPresent()) { ReleaseAllKnobs(); return(text); } debug.Log("hand position: " + hand.Centre()); debug.Log("text: " + text); var closest = knobs.FindClosestTo(hand); // debug.Log("Closest: " + closest); if (closest == null) { HandleAwayFromKnobs(); // debug.Log("Nearly grabbed things: " + string.Join(", ", close_things.ToList().Select(t => t.name).ToArray())); return(text); } HandleCloseToKnob(hand, closest); return(text); }