protected virtual void SetupPlayer() { if (gazeController == null) { GameObject simPlayer = SDK_InputGearVRSimulator.FindInScene(); if (simPlayer != null) { gazeController = (gazeController == null ? simPlayer.transform.Find(GAZE_CONTROLLER_NAME).GetComponent <SDK_ControllerGearVRSim>() : gazeController); } } }
/// <summary> /// The GetPlayArea method returns the Transform of the object that is used to represent the play area in the scene. /// </summary> /// <returns>A transform of the object representing the play area in the scene.</returns> public override Transform GetPlayArea() { if (area == null) { GameObject simPlayer = SDK_InputGearVRSimulator.FindInScene(); if (simPlayer) { area = simPlayer.transform; } } return(area); }
/// <summary> /// The GetHeadset method returns the Transform of the object that is used to represent the headset in the scene. /// </summary> /// <returns>A transform of the object representing the headset in the scene.</returns> public override Transform GetHeadset() { if (camera == null) { GameObject simPlayer = SDK_InputGearVRSimulator.FindInScene(); if (simPlayer) { camera = simPlayer.transform.Find("Neck/Camera"); } } return(camera); }
/// <summary> /// The GetControllerModel method returns the model alias for the given controller hand. /// </summary> /// <param name="hand">The hand enum of which controller model to retrieve.</param> /// <returns>The GameObject that has the model alias within it.</returns> public override GameObject GetControllerModel(ControllerHand hand) { if (hand != ControllerHand.Right) { return(null); } GameObject model = null; GameObject simPlayer = SDK_InputGearVRSimulator.FindInScene(); if (simPlayer != null) { model = simPlayer.transform.Find(string.Format("{0}/Anchor", GAZE_CONTROLLER_NAME)).gameObject; } return(model); }
/// <summary> /// finds the actual controller for the specified hand (identified by name) and returns it /// </summary> /// <param name="hand">the for which to find the respective controller gameobject</param> /// <returns>the gameobject of the actual controller corresponding to the specified hand</returns> protected virtual GameObject GetActualController(ControllerHand hand) { GameObject simPlayer = SDK_InputGearVRSimulator.FindInScene(); GameObject controller = null; if (simPlayer != null) { switch (hand) { case ControllerHand.Right: controller = simPlayer.transform.Find(GAZE_CONTROLLER_NAME).gameObject; break; default: break; } } return(controller); }