private void AddVrCharController() { VRCharacterController vrCharCont = m_rig.AddComponent <VRCharacterController>(); // Setup variable values below? // ______ // ______ }
void Start() { leftController = transform.root.GetComponent <VRLocomotionRig>().s_handLeft.GetComponent <VRBasicController>(); rightController = transform.root.GetComponent <VRLocomotionRig>().s_handRight.GetComponent <VRBasicController>(); leftController.ropeTag = climbTag; rightController.ropeTag = climbTag; cont = transform.root.GetComponent <VRCharacterController>(); }
void Start() { SetUpRootTransform(); m_leftController = transform.root.GetComponent <VRLocomotionRig>().s_handLeft.GetComponent <VRBasicController>(); m_rightController = transform.root.GetComponent <VRLocomotionRig>().s_handRight.GetComponent <VRBasicController>(); m_agent = m_root.GetComponent <UnityEngine.AI.NavMeshAgent>(); m_vrCharCont = m_root.GetComponent <VRCharacterController>(); // StartCoroutine("RecalibrateOnTick"); StartCoroutine("TrackHeadsetVelocity"); }
protected override void OnStart() { base.OnStart(); _vrCharacterController = _bootstrap.GetController(ControllerTypes.VRCharacter) as VRCharacterController; _vrCharacterController.Reset += OnReset; _sfxController = _bootstrap.GetController(ControllerTypes.SoundSFX) as SFXController; _transform = GetComponent <Transform>(); _navMesh = GetComponent <UnityEngine.AI.NavMeshAgent>(); //_fade = characterCamera.GetComponent<OVRScreenFade>(); StartCoroutine(TriggerClick()); StartCoroutine(PlayFootsteps()); }
void CenterPointTrace() { if (_vrCharacterController == null) { _vrCharacterController = _bootstrap.GetController(ControllerTypes.VRCharacter) as VRCharacterController; } //var fwd = characterCamera.TransformDirection(Vector3.forward); RaycastHit other; var ray = new Ray(characterCamera.position, characterCamera.forward); if (Physics.Raycast(ray, out other, Mathf.Infinity, mask)) { //_text.text = other.collider.name; EndPoint = ray.GetPoint(other.distance * 0.8f); actuaButton = other.transform.gameObject.GetComponent <Button>(); if (_vrCharacterController.IsGameStarted) { GameObject go = null; if (other.collider.CompareTag(moveToTag)) { go = other.collider.gameObject; } if (go != null) { isMoving = true; if (moveTo != go) { if (moveTo != null) { StopMove(); } moveTo = go; } Vector3 v; if (go.CompareTag(moveToTag)) { v = other.point + (characterCamera.forward * 0.5f); v.y = other.collider.transform.position.y; } else { v = go.transform.position; } Move(v); } else if (moveTo != null) { StopMove(); isMoving = false; moveTo = null; } } Debug.DrawRay(ray.origin, ray.direction * other.distance, Color.red); if (actuaButton && singleClick) { singleClick = false; ClickTimeLapse = 0f; } } else { EndPoint = ray.GetPoint(1000); Debug.DrawRay(ray.origin, ray.direction * 100, Color.red); } }