void GetHands() { //rig = VRGestureManager.Instance.rig; rig = VRGestureRig.GetPlayerRig(gestureSettings.playerID); vrHand = rig.GetHand(rig.mainHand); vrHandInput = rig.GetInput(rig.mainHand); }
private Vector3 buttonRectScale; // new Vector3(0.6666f, 1, 0.2f); void Start() { panelManager = GetComponentInChildren <VRGestureUIPanelManager>(); rootCanvas = GetComponent <Canvas>(); vrHandUIPanel = transform.Find("Panels"); // start with hand UI visible uiVisible = true; Utils.ToggleCanvasGroup(panelManager.parentCanvasGroup, uiVisible); buttonRectScale = new Vector3(0.6666f, 1, 0.2f); // get vr player hand and camera rig = VRGestureRig.GetPlayerRig(gestureSettings.playerID); menuHandedness = (rig.mainHand == Handedness.Left) ? Handedness.Right : Handedness.Left; Handedness oppositeHand = rig.mainHand == Handedness.Left ? Handedness.Right : Handedness.Left; vrMenuHand = rig.GetHand(menuHandedness); vrCam = rig.head; GenerateGesturesMenu(); StartCoroutine(GenerateNeuralNetMenuButtons()); if (!gestureSettings.beginInDetectMode) { panelManager.FocusPanel("Select Neural Net Menu"); } else { panelManager.FocusPanel("Detect Menu"); } }
private Vector3 buttonRectScale; // new Vector3(0.6666f, 1, 0.2f); void Start() { panelManager = GetComponentInChildren <VRGestureUIPanelManager>(); menuHandedness = (VRGestureManager.Instance.gestureHand == HandType.Left)? HandType.Right : HandType.Left; rootCanvas = GetComponent <Canvas>(); vrHandUIPanel = transform.Find("Panels"); // start with hand UI visible uiVisible = true; ToggleCanvasGroup(panelManager.canvasGroup, uiVisible); vrGestureGallery = transform.GetComponentInChildren <VRGestureGallery>(true); buttonRectScale = new Vector3(0.6666f, 1, 0.2f); // get vr player hand and camera myAvatar = VRGestureManager.Instance.rig; vrMenuHand = myAvatar.GetHand(menuHandedness); vrCam = VRGestureManager.Instance.rig.head; GenerateRecordMenuButtons(); GenerateEditMenuButtons(); GenerateNeuralNetMenuButtons(); }
private void Awake() { gestureSettings = Utils.GetGestureSettings(); gestureRig = VRGestureRig.GetPlayerRig(gestureSettings.playerID); EventCenter.AddListener(EventDefine.ShowGestureInfPanel, ShowGestureInfPanel); Init(); }
void GetHands() { HandType handedness = VRGestureManager.Instance.gestureHand; // needed to set it to something to prevent error rig = VRGestureManager.Instance.rig; vrHand = rig.GetHand(handedness); vrHandInput = rig.GetInput(handedness); }
//Almost all of this should get plugged into Recognizer public void RecognizeLine(List <Vector3> capturedLine, Handedness hand, VRGestureRig sender) { if (IsGestureBigEnough(capturedLine)) { //Detect if the captured line meets minimum gesture size requirements double[] networkInput = Utils.FormatLine(capturedLine, hand); string gesture = GetGesture(networkInput); string confidenceValue = currentConfidenceValue.ToString("N3"); // broadcast gesture detected event if (currentConfidenceValue > gestureSettings.confidenceThreshold) { if (GestureDetectedEvent != null) { GestureDetectedEvent(gesture, currentConfidenceValue, hand); //Check if the other hand has recently caught a gesture. //CheckForSyncGestures(gesture, hand); if (hand == Handedness.Left) { //leftCapture.SetRecognizedGesture(gesture); lastLeftGesture = gesture; lastLeftConfidenceValue = currentConfidenceValue; lastLeftDetected = DateTime.Now; } else if (hand == Handedness.Right) { //rightCapture.SetRecognizedGesture(gesture); lastRightGesture = gesture; lastRightConfidenceValue = currentConfidenceValue; lastRightDetected = DateTime.Now; } Debug.Log("Left detected " + lastLeftGesture); Debug.Log("Right detected " + lastRightGesture); if (CheckForSync(gesture)) { gesture = lastLeftGesture.Substring(LeftHandSyncPrefix.Length); GestureDetectedEvent(gesture, (lastLeftConfidenceValue + lastRightConfidenceValue) / 2, hand, true); } } } else { if (GestureRejectedEvent != null) { GestureRejectedEvent("Confidence Too Low", gesture, currentConfidenceValue); } } } else { //broadcast that a gesture is too small?? if (GestureRejectedEvent != null) { GestureRejectedEvent("Gesture is too small"); } } }
private void Awake() { Init(); gestureSettings = Utils.GetGestureSettings(); gestureRig = VRGestureRig.GetPlayerRig(gestureSettings.playerID); EventCenter.AddListener <string>(EventDefine.ShowGestureEditPanel, ShowGestureEditPanel); EventCenter.AddListener(EventDefine.FinishedGestureRecord, FinishedGestureRecord); EventCenter.AddListener <bool>(EventDefine.UIPointHovering, UIPointHovering); }
void Init() { if (FindObjectOfType <VRGestureRig>() != null) { rig = FindObjectOfType <VRGestureRig>(); playerHead = rig.head; playerHand = rig.GetHand(gestureHand); input = rig.GetInput(gestureHand); } }
void OnEnable() { gestureSettings = Utils.GetGestureSettings(); rig = VRGestureRig.GetPlayerRig(gestureSettings.playerID); GestureRecognizer.GestureDetectedEvent += OnGestureDetected; GestureRecognizer.GestureRejectedEvent += OnGestureRejected; VRGestureUIPanelManager.OnPanelFocusChanged += PanelFocusChanged; //VRControllerUIInput.OnVRGuiHitChanged += VRGuiHitChanged; }
void Start() { rig = FindObjectOfType <VRGestureRig>(); if (rig == null) { Debug.Log("there is no VRGestureRig in the scene, please add one"); } playerHead = rig.head; playerHandR = rig.handRight; playerHandL = rig.handLeft; input = rig.GetInput(rig.mainHand); }
void Start() { myAvatar = FindObjectOfType <VRGestureRig>(); if (myAvatar == null) { Debug.Log("there is no VRGestureRig in the scene, please add one"); } rb = GetComponent <Rigidbody>(); playerHead = myAvatar.head; playerHandR = myAvatar.handRight; playerHandL = myAvatar.handLeft; StartCoroutine(DestroySelf()); }
private void Awake() { gestureSettings = Utils.GetGestureSettings(); gestureRig = VRGestureRig.GetPlayerRig(gestureSettings.playerID); back_Button = transform.Find("Back_Button").GetComponent <Button>(); back_Button.onClick.AddListener(() => { EventCenter.Broadcast(EventDefine.ShowGestureMainPanel); gameObject.SetActive(false); }); GestureName = transform.Find("Name").GetComponent <Text>(); GestureAccuracy = transform.Find("Accruacy").GetComponent <Text>(); EventCenter.AddListener(EventDefine.ShowGestureDetectPanel, ShowGestureDetectPanel); GestureRecognizer.GestureDetectedEvent += GestureRecognizer_GestureDetectedEvent; gameObject.SetActive(false); }
void Awake() { gestureSettings = Utils.GetGestureSettings(); gestureRig = VRGestureRig.GetPlayerRig(gestureSettings.playerID); gesture_inf = transform.Find("Ges_Inf").GetComponent <Button>(); gesture_inf.onClick.AddListener(() => { EventCenter.Broadcast(EventDefine.ShowGestureInfPanel); gameObject.SetActive(false); }); gesture_detect = transform.Find("Ges_Detect").GetComponent <Button>(); gesture_detect.onClick.AddListener(() => { EventCenter.Broadcast(EventDefine.ShowGestureDetectPanel); gameObject.SetActive(false); }); EventCenter.AddListener(EventDefine.ShowGestureMainPanel, ShowGesturePanel); ShowGesturePanel(); }
public CaptureHand(VRGestureRig _rig, Transform _perp, Handedness _hand, GestureTrail _myTrail = null) { rig = _rig; hand = _hand; playerHand = rig.GetHand(hand); playerHead = rig.head; perpTransform = _perp; input = rig.GetInput(hand); currentCapturedLine = new List <Vector3>(); if (_myTrail != null) { myTrail = _myTrail; myTrail.AssignHand(this); } Start(); }
public void GetHand() { if (GameObject.Find("Controller Manager").GetComponent <NewEarthController>().isLeft == true) { gestureHand = HandType.Left; rig = FindObjectOfType <VRGestureRig>(); playerHead = rig.head; playerHand = rig.GetHand(gestureHand); input = rig.GetInput(gestureHand); //Debug.Log("hand is left"); } else { gestureHand = HandType.Right; rig = FindObjectOfType <VRGestureRig>(); playerHead = rig.head; playerHand = rig.GetHand(gestureHand); input = rig.GetInput(gestureHand); //Debug.Log("hand is right"); } }
protected override void Start() { base.Start(); SetInputModule(); rig = VRGestureManager.Instance.rig; ControllerInputLeft = rig.GetInput(HandType.Left); ControllerInputRight = rig.GetInput(HandType.Right); if (Initialized == false) { Instance = this; ControllerCamera = new GameObject("Controller UI Camera").AddComponent <Camera>(); ControllerCamera.transform.parent = this.transform; ControllerCamera.clearFlags = CameraClearFlags.Nothing; //CameraClearFlags.Depth; ControllerCamera.cullingMask = 0; // 1 << LayerMask.NameToLayer("UI"); ControllerCamera.nearClipPlane = 0.0001f; Controllers = new Transform[] { rig.handLeft, rig.handRight }; Cursors = new RectTransform[2]; for (int index = 0; index < Cursors.Length; index++) { GameObject cursor = new GameObject("Cursor " + index); Canvas canvas = cursor.AddComponent <Canvas>(); //cursor.transform.parent = this.transform; cursor.AddComponent <CanvasRenderer>(); cursor.AddComponent <CanvasScaler>(); cursor.AddComponent <UIIgnoreRaycast>(); cursor.AddComponent <GraphicRaycaster>(); // set cursor size cursor.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, CursorSize); cursor.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, CursorSize); canvas.renderMode = RenderMode.WorldSpace; canvas.sortingOrder = 1000; //set to be on top of everything Image image = cursor.AddComponent <Image>(); image.sprite = CursorSprite; image.material = CursorMaterial; if (CursorSprite == null) { Debug.LogError("Set CursorSprite on " + this.gameObject.name + " to the sprite you want to use as your cursor.", this.gameObject); } Cursors[index] = cursor.GetComponent <RectTransform>(); } CurrentPoint = new GameObject[Cursors.Length]; CurrentPressed = new GameObject[Cursors.Length]; CurrentDragging = new GameObject[Cursors.Length]; PointEvents = new PointerEventData[Cursors.Length]; Canvas[] canvases = GameObject.FindObjectsOfType <Canvas>(); foreach (Canvas canvas in canvases) { canvas.worldCamera = ControllerCamera; } Initialized = true; } }
public virtual void Awake() { gestureSettings = Utils.GetGestureSettings(); gestureRig = VRGestureRig.GetPlayerRig(gestureSettings.playerID); GestureRecognizer.GestureDetectedEvent += GestureRecognizer_GestureDetectedEvent; }