// Update is called once per frame void Update() { if (VRInputHandler.OnButtonDown(VRInputHandler.INTERACT_LEFT)) { TryGrab(VRReferences.LeftHand, radius, ref leftHandObj, false); } else if (VRInputHandler.OnButtonUp(VRInputHandler.INTERACT_LEFT)) { if (leftHandObj) { leftHandObj.Release(VRReferences.LeftHand.position - lastPosLeft); leftHandObj = null; } } if (VRInputHandler.OnButtonDown(VRInputHandler.INTERACT_RIGHT)) { TryGrab(VRReferences.RightHand, radius, ref rightHandObj); } else if (VRInputHandler.OnButtonUp(VRInputHandler.INTERACT_RIGHT)) { if (rightHandObj) { rightHandObj.Release(VRReferences.RightHand.position - lastPosRight); rightHandObj = null; } } lastPosLeft = VRReferences.LeftHand.position; lastPosRight = VRReferences.RightHand.position; }
// Update is called once per frame void Update() { if (shieldsInWorld < maxLevel && VRInputHandler.OnButtonDown(VRInputHandler.CREATE_SHIELD)) { if (text) { Destroy(text.gameObject); text = null; } ShieldGrid shields = GameObject.Instantiate(shieldGridPrefab); Vector3 fwd = -VRReferences.Head.position + VRReferences.LeftHand.position; fwd.y = 0; if (fwd.magnitude == 0) { fwd = VRReferences.Head.forward; } fwd.Normalize(); shields.transform.position = VRReferences.LeftHand.position + fwd * spawnDistance; shields.transform.forward = fwd; shields.Init(this); shieldsInWorld++; } }