private void StartGame() { if (rightHandIsOn) { SetRightHand(); } else { SetLeftHand(); } if (!GameManager.instance.IsOculusGo) { ViveInput.AddPress(HandRole.LeftHand, ControllerButton.Trigger, LeftTrigger); ViveInput.AddPress(HandRole.RightHand, ControllerButton.Trigger, RightTrigger); } else { goProperty = ViveRoleProperty.New(DeviceRole.Device1); _pt.viveRole.roleValue = goProperty.roleValue; goProperty.onRoleChanged += GoProperty_onRoleChanged; } }
void Update() { Collider[] Colliders = Physics.OverlapSphere(transform.position, 0.1f); if (ViveInput.GetPressDown(HandRole.RightHand, ControllerButton.Trigger) || ViveInput.GetPressDown(HandRole.LeftHand, ControllerButton.Trigger)) { if (Colliders.Length > 0 && Colliders[0].gameObject.layer == 14) { Colliders[0].gameObject.transform.parent = this.transform; child = Colliders[0].gameObject; child.GetComponent <Rigidbody>().isKinematic = true; child.GetComponent <Rigidbody>().useGravity = false; } } if (ViveInput.GetPressUp(HandRole.RightHand, ControllerButton.Trigger) || ViveInput.GetPressUp(HandRole.LeftHand, ControllerButton.Trigger)) { if (child != null) { child.GetComponent <Rigidbody>().isKinematic = false; uint deviceIndex = ViveRoleProperty.New(HandRole.RightHand).GetDeviceIndex(); Vector3 v = VRModule.GetDeviceState(deviceIndex, false).velocity; Vector3 Av = VRModule.GetDeviceState(deviceIndex, false).angularVelocity; child.GetComponent <Rigidbody>().velocity = v; child.GetComponent <Rigidbody>().angularVelocity = Av; child.GetComponent <Rigidbody>().useGravity = true; child.transform.parent = null; } } }
private void OnDisable() { if (m_exCamViveRole != null) { m_exCamViveRole.onDeviceIndexChanged -= OnDeviceIndexChanged; m_exCamViveRole = null; } }
private void OnEnable() { ReloadFields(); if (m_exCamViveRole == null && ExternalCameraHook.Active) { m_exCamViveRole = ExternalCameraHook.Instance.viveRole; m_exCamViveRole.onDeviceIndexChanged += OnDeviceIndexChanged; } UpdateRecenterButtonVisible(); }
private void Start() { mHandRole = GetComponent <ViveRoleSetter>().viveRole; if (LightningPrefab) { mLightningInstance = Instantiate(LightningPrefab, transform); mLightningInstance.SetActive(false); mLightningScript = mLightningInstance.GetComponent <LightningBoltScript>(); } mAudioSource = GetComponent <AudioSource>(); }
public void Start() { LiftState = ForceLiftState.Idle; mHand = GetComponent <ViveRoleSetter>().viveRole; if (LiftSelector) { mLiftSelector = Instantiate(LiftSelector); mLiftSelector.SetActive(false); } mAudioSource = GetComponent <AudioSource>(); }
void Awake() { mHandRole = GetComponent <ViveRoleSetter>().viveRole; mModel = transform.Find("Model").gameObject; }