Create a gist now

Instantly share code, notes, and snippets.

@kihira /HandInfoPanel.cs Secret
Last active Apr 2, 2016

What would you like to do?
[Header("Tracking Settings")]
[SerializeField] private HandController handController;
[SerializeField] private float retrackTime = 2f;
private float detachedTime = 0f;
[SerializeField] private GameObject canvas;
private HandModel hand;
void Update()
// Attempt to reattach if possible
if (hand == null)
if (detachedTime > retrackTime && canvas.activeSelf)
Debug.Log("Failed to retrack correct hand, deactivating canvas");
foreach (var graphicHand in handController.GetAllGraphicsHands())
if (!graphicHand.GetLeapHand().IsLeft)
hand = graphicHand;
detachedTime = 0f;
detachedTime += Time.deltaTime;
if (hand == null) return;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment