public bool CheckReleaseInput(VirtualViveController _virtualCtrl) { if (VirtualViveController.GetInput(_virtualCtrl, releaseInput)) { return(true); } return(false); }
void Start() { headRb = headTrans.GetComponent <Rigidbody>(); leftCtrlRb = leftCtrlTrans.GetComponent <Rigidbody>(); rightCtrlRb = rightCtrlTrans.GetComponent <Rigidbody>(); leftCtrlVirtualViveCtrl = leftCtrlTrans.GetComponent <VirtualViveController>(); rightCtrlVirtualViveCtrl = rightCtrlTrans.GetComponent <VirtualViveController>(); defArmLen = Vector3.Distance(leftArmTrans.position, leftCtrlTrans.position); InitControllerTransform(); }
// Use this for initialization void Start() { SignBoard.SetActive(true); tutoText = SignBoard.transform.GetComponentInChildren <TextMeshPro>(); rightGrabController = GameObject.Find("RightController").GetComponent <GrabController>(); leftGrabController = GameObject.Find("LeftContorller").GetComponent <GrabController>(); rightController = GameObject.Find("RightController").GetComponent <VirtualViveController>(); leftController = GameObject.Find("LeftContorller").GetComponent <VirtualViveController>(); enemy = GameObject.Find("EnemySpawner").GetComponent <EnemySpawner>(); alpha = 1.0f; }
static public bool GetInput(VirtualViveController _virtualCtrl, ViveControllerInput _input) { switch (_input) { case VirtualViveController.ViveControllerInput.TouchPadKeyDown: return(_virtualCtrl.GetTouchPadDown()); case VirtualViveController.ViveControllerInput.TouchPadKey: return(_virtualCtrl.GetTouchPad()); case VirtualViveController.ViveControllerInput.TouchPadKeyUp: return(_virtualCtrl.GetTouchPadUp()); case VirtualViveController.ViveControllerInput.HairTriggerKeyDown: return(_virtualCtrl.GetHairTriggerDown()); case VirtualViveController.ViveControllerInput.HairTriggerKey: return(_virtualCtrl.GetHairTrigger()); case VirtualViveController.ViveControllerInput.HairTriggerKeyUp: return(_virtualCtrl.GetHairTriggerUp()); case VirtualViveController.ViveControllerInput.GripKeyKeyDown: return(_virtualCtrl.GetGripDown()); case VirtualViveController.ViveControllerInput.GripKeyKey: return(_virtualCtrl.GetGrip()); case VirtualViveController.ViveControllerInput.GripKeyKeyUp: return(_virtualCtrl.GetGripUp()); case VirtualViveController.ViveControllerInput.SystemKeyKeyDown: return(_virtualCtrl.GetSystemDown()); case VirtualViveController.ViveControllerInput.SystemKeyKey: return(_virtualCtrl.GetSystem()); case VirtualViveController.ViveControllerInput.SystemKeyKeyUp: return(_virtualCtrl.GetSystemUp()); } return(false); }
void MoveControllerTransform(Transform _trans, Transform _armTrans) { // コントローラーの親オブジェクトに腕部を設定 Transform befParent = _trans.parent; _trans.parent = _armTrans; // コントローラーの腕部からの距離を変更 float ctrlMoveVec = (Input.GetAxis("Mouse ScrollWheel") * ctrlDisMoveMouseSence); if (FixedWheelDownInput) { ctrlMoveVec -= ctrlDisMoveSpd; } if (FixedWheelUpInput) { ctrlMoveVec += ctrlDisMoveSpd; } ctrlMoveVec = Mathf.Clamp(ctrlMoveVec, -1.0f, 1.0f); if (ctrlMoveVec != 0.0f) { float dis = Vector3.Distance(_trans.position, _armTrans.position); Vector3 vec = (_trans.position - _armTrans.position).normalized; if ((dis + ctrlMoveVec) > ctrlMinDis) { dis += (ctrlMoveVec); } else { dis = ctrlMinDis; } _trans.position = (_armTrans.position + (dis * vec)); } // 中クリックでカーソル方向に腕を向ける if (GetInput(midClickKeyCodeList)) { LookMouseCursor(_armTrans); } else { // マウスの動きのベクトルを取得 Vector3 rotVec = new Vector3((-Input.GetAxis("Mouse Y") * camRotMouseSenceVertical), (Input.GetAxis("Mouse X") * camRotMouseSenceHorizontal), 0.0f); if (FixedRotUpInput) { rotVec = new Vector3((-1.0f * camRotKeySenceVertical), rotVec.y, rotVec.z); } if (FixedRotDownInput) { rotVec = new Vector3((1.0f * camRotKeySenceVertical), rotVec.y, rotVec.z); } if (FixedRotLeftInput) { rotVec = new Vector3(rotVec.x, (-1.0f * camRotKeySenceHorizontal), rotVec.z); } if (FixedRotRightInput) { rotVec = new Vector3(rotVec.x, (1.0f * camRotKeySenceHorizontal), rotVec.z); } // コントローラーを腕部を基準に回転移動 _armTrans.Rotate((new Vector3(rotVec.x, 0.0f, 0.0f) * ctrlRotSpd), Space.Self); _armTrans.Rotate((new Vector3(0.0f, rotVec.y, 0.0f) * ctrlRotSpd), Space.World); } // コントローラーの親オブジェクトを戻す _trans.parent = befParent; // 左手 VirtualViveController virtualViveCtrl; if (_trans == leftCtrlTrans) { virtualViveCtrl = leftCtrlVirtualViveCtrl; } // 右手 else { virtualViveCtrl = rightCtrlVirtualViveCtrl; } // タッチパッド virtualViveCtrl.VirtualTouchKey = FixedTouchPadInput; // トリガー virtualViveCtrl.VirtualTriggerKey = FixedTriggerInput; // グリップ virtualViveCtrl.VirtualGripKey = FixedGripInput; }