private void SetControllerInputActive(bool active) { if (controllerMain != null) { controllerMain.SetActive(active); } if (controllerPointers == null || controllerPointers.Length <= activeControllerPointer) { return; } controllerPointers[activeControllerPointer].SetActive(active); // Update the pointer type only if this is currently activated. if (!active) { return; } GvrLaserPointer pointer = controllerPointers[activeControllerPointer].GetComponentInChildren <GvrLaserPointer>( true); if (pointer != null) { GvrPointerInputModule.Pointer = pointer; } }
private void SetControllerInputActive(bool active) { if (controllerMain != null) { controllerMain.SetActive(active); } if (controllerPointer == null) { return; } controllerPointer.SetActive(active); // Update the pointer type only if this is currently activated. if (!active) { return; } GvrLaserPointer pointer = controllerPointer.GetComponentInChildren <GvrLaserPointer>(true); if (pointer != null) { pointer.SetAsMainPointer(); } }
void Start() { constellationMenu = SceneHelpers.FindObjectOfType <ConstellationMenuRoot>(true); Assert.IsNotNull(constellationMenu); controller = SceneHelpers.FindObjectOfType <GvrTrackedController>(true); Assert.IsNotNull(controller); pointer = controller.GetComponentInChildren <GvrLaserPointer>(true); Assert.IsNotNull(pointer); }
void Start() { clickMenu = SceneHelpers.FindObjectOfType <ClickMenuRoot>(true); Assert.IsNotNull(clickMenu); controller = SceneHelpers.FindObjectOfType <GvrControllerVisualManager>(true); Assert.IsNotNull(controller); pointer = controller.GetComponentInChildren <GvrLaserPointer>(); Assert.IsNotNull(pointer); }
private void ShowPointer() { pointer.SetActive(true); GvrLaserPointer laser = pointer.GetComponentInChildren <GvrLaserPointer>(true); Assert.IsNotNull(laser); GvrPointerInputModule.Pointer = laser; }
//------------------------------------------------------------ #region METHODS protected void OnEnable() { _hasPressedButton = false; _laserPointer = GetComponentInChildren <GvrLaserPointer>(); upLever.OnPressed = PressedButton; #if UNITY_EDITOR StartCoroutine(_SetupEditorVRMode()); #endif }
void Awake() { _Reticle = FindObjectOfType <GvrReticlePointer>(); _Laser = FindObjectOfType <GvrLaserPointer>(); SetupGearVrOrGo(); #if UNITY_EDITOR || UNITY_STANDALONE if (OVRPlugin.GetSystemHeadsetType().ToString().Contains("Rift")) { SetupForRift(); } else { ActivateMouse(); } #endif }
private void SetupPointer() { CreatePointer(); pointer.SetActive(true); GvrLaserPointer laser = pointer.GetComponentInChildren <GvrLaserPointer>(); Assert.IsNotNull(laser); laser.SetAsMainPointer(); // Turn off tooltips. GvrTooltip tooltip = pointer.GetComponentInChildren <GvrTooltip>(); if (tooltip != null) { tooltip.transform.parent.gameObject.SetActive(false); } }
public void Setup() { GameObject laserObj = new GameObject(); laserObj.AddComponent <LineRenderer>(); laserVisual = ComponentHelpers.AddComponentInvokeLifecycle <GvrLaserVisual>(laserObj); laserVisual.lerpThreshold = 0.0f; pointer = ComponentHelpers.AddComponentInvokeLifecycle <GvrLaserPointer>(laserObj); pointer.raycastMode = GvrBasePointer.RaycastMode.Direct; pointer.maxPointerDistance = MAX_RETICLE_DISTANCE; pointer.defaultReticleDistance = MAX_RETICLE_DISTANCE; ComponentHelpers.CallStart(pointer); reticle = new GameObject(); laserVisual.Reticle = reticle.transform; raycastResult.worldPosition = CLOSE_HIT_POS; raycastResult.distance = CLOSE_HIT_POS.z; }
private Vector3 GetBrushPosition() { GvrLaserPointer pointer = GvrPointerInputModule.Pointer as GvrLaserPointer; if (pointer == null) { return(Vector3.zero); } Vector3 pointerEndPoint; if (pointer.CurrentRaycastResult.gameObject != null) { pointerEndPoint = pointer.CurrentRaycastResult.worldPosition; } else { pointerEndPoint = pointer.GetPointAlongPointer(pointer.defaultReticleDistance); } Vector3 result = transform.InverseTransformPoint(pointerEndPoint); return(result); }
public override void OnStartLocalPlayer() { Debug.Log("In OnStartLocalPlayer"); // tag the local player so we can look for it later in other objects gameObject.tag = "Player"; //Make sure the MainCamera is the one for our local player Camera currentMainCamera = Camera.main; GameObject playerCameraObj = gameObject.transform.Find("PlayerCamera").gameObject; Camera playercamera = playerCameraObj.GetComponent <Camera> (); playercamera.tag = "MainCamera"; if (currentMainCamera != null) { currentMainCamera.enabled = false; } playercamera.enabled = true; // Set the position of the server player to be the eye of god. // Also disable tracking if (isServer && LocalPlayerOptions.singleton.observer) { m_observer = true; if (LocalPlayerOptions.singleton.god) { // gameObject.transform.position = new Vector3 (0, 1.6f, 0); gameObject.transform.position = new Vector3(0, 3, -.5f); gameObject.transform.Rotate(35, 0, 0); } } else { // Add the Highlighter, audiolistener, GvrAudioListener, and GvrPointerPhysicsRaycaster scripts to this object HighlightingRenderer hlrender = playerCameraObj.GetComponent <HighlightingRenderer>(); if (hlrender == null) { hlrender = playerCameraObj.AddComponent <HighlightingRenderer> (); hlrender.LoadPreset("Speed"); } // ViconActor tracking = gameObject.GetComponent<ViconActor> (); MQTTTrack tracking = gameObject.GetComponent <MQTTTrack>(); if (LocalPlayerOptions.singleton.trackLocalPlayer) { // Turn on Holojam // Debug.Log("Turning on Holojam"); // GameObject holojam = GameObject.FindGameObjectWithTag ("Holojam"); // holojam.SetActive (true); // tracking.track = true; // tracking.SetLabel(LocalPlayerOptions.singleton.mocapName); // Turn on MQTT Debug.Log("Turning on MQTT"); GameObject mqtt = GameObject.FindGameObjectWithTag("MQTT"); mqtt.SetActive(true); tracking.SetLabel("Update/" + LocalPlayerOptions.singleton.mocapName); tracking.Track = true; } else { tracking.Track = false; } } playerCameraObj.AddComponent <AudioListener>(); playerCameraObj.AddComponent <GvrAudioListener> (); playerCameraObj.AddComponent <GvrPointerPhysicsRaycaster> (); #if UNITY_HAS_GOOGLEVR && (UNITY_ANDROID || UNITY_EDITOR) GameObject controllerPointer = gameObject.transform.Find("GvrControllerPointer").gameObject; IAAInputManager inputscript = m_InputManager.GetComponent <IAAInputManager>(); inputscript.controllerPointer = controllerPointer; inputscript.whatAreWe(); inputscript.SetVRInputMechanism(); // Add the GvrArmModelOffset scripts to the controller and laser GameObject controller = controllerPointer.transform.Find("Controller").gameObject; GvrArmModelOffsets controllerscript = controller.AddComponent <GvrArmModelOffsets> (); controllerscript.joint = GvrArmModelOffsets.Joint.Wrist; GameObject laser = controllerPointer.transform.Find("Laser").gameObject; GvrArmModelOffsets laserscript = laser.AddComponent <GvrArmModelOffsets> (); laserscript.joint = GvrArmModelOffsets.Joint.Pointer; // Add the GvrLaserPointer script to the laser object GvrLaserPointer laserPtrScript = laser.AddComponent <GvrLaserPointer> (); laserPtrScript.maxReticleDistance = 4.0f; GameObject reticle = laser.transform.Find("Reticle").gameObject; laserPtrScript.reticle = reticle; #endif if (isServer && m_observer) { // Make the avatar invisible gameObject.transform.Find("PlayerCamera/Gamer").gameObject.SetActive(false); gameObject.transform.Find("GvrControllerPointer/Controller/ddcontroller").gameObject.SetActive(false); if (m_cycleCameras) { // Remove the server camera (the first one) and save it. m_observerCamera = m_playerCameras [0]; m_playerCameras.RemoveAt(0); StartCoroutine(cycleThroughCameras()); } } }