public static void syncPOVXCamera() { handlePOVXStatus(); if (povEnabledValue && !POVPaused) { VRPatcher.SyncToMainTransform(Camera.main.transform, positionOnly: false, adjustHead: true); } }
/// <summary> /// VRデバイスのロード。 /// </summary> IEnumerator LoadDevice(string newDevice) { bool vrMode = newDevice != DeviceNone; // 指定されたデバイスの読み込み. UnityEngine.XR.XRSettings.LoadDeviceByName(newDevice); // 次のフレームまで待つ. yield return(null); // VRモードを有効にする. UnityEngine.XR.XRSettings.enabled = vrMode; // 次のフレームまで待つ. yield return(null); // デバイスの読み込みが完了するまで待つ. while (UnityEngine.XR.XRSettings.loadedDeviceName != newDevice || UnityEngine.XR.XRSettings.enabled != vrMode) { yield return(null); } //UnityEngine.XR.XRSettings.gameViewRenderMode = UnityEngine.XR.GameViewRenderMode.BothEyes; List <UnityEngine.XR.XRNodeState> states = new List <UnityEngine.XR.XRNodeState>(); UnityEngine.XR.InputTracking.GetNodeStates(states); foreach (UnityEngine.XR.XRNodeState state in states) { string name = UnityEngine.XR.InputTracking.GetNodeName(state.uniqueID); Vector3 pos = new Vector3(); bool got_pos = state.TryGetPosition(out pos); VRLog.Info("XRNode {0}, position available {1} {2}", name, got_pos, pos); } if (vrMode) { VRPatcher.Patch(); // Boot VRManager! // Note: Use your own implementation of GameInterpreter to gain access to a few useful operatoins // (e.g. characters, camera judging, colliders, etc.) VRManager.Create <HS2Interpreter>(CreateContext("VRContext.xml")); if (((HS2VRSettings)VR.Settings).DefaultMode.Equals("Seated")) { VR.Manager.SetMode <GenericSeatedMode>(); } else { VR.Manager.SetMode <GenericStandingMode>(); } if (((HS2VRSettings)VR.Settings).PrivacyMode.Equals(true)) { PrivacyMode.Enable(); } } }
public static void SpecialTreatmentManagerSetCameraAndCharaPositionPostfix(Camera ___cam, Manager.SpecialTreatmentRoomManager __instance) { VRLog.Info("Setting VR Camera to game camera (Special TreatmentRoom SetCameraPosition)"); if (__instance.ConciergeHeroine != null) { AdjustForFOVDifference(___cam.transform, __instance.ConciergeHeroine.transform, TITLE_FOV, GetVRFOV(), TITLE_DISTANCE_ADJ_RATIO, true); } VRPatcher.MoveVRCameraToTarget(___cam.transform); }
public static void LobbySceneManagerSetCameraAndCharaPositionPostfix(Camera ___cam, LobbySceneManager __instance) { VRLog.Info("Setting VR Camera to game camera (Lobby SetCamChar)"); if (__instance.heroines != null && __instance.heroines[0] != null) { AdjustForFOVDifference(___cam.transform, __instance.heroines[0].transform, LOBBY_FOV, GetVRFOV(), LOBBY_DISTANCE_ADJ_RATIO, true); } VRPatcher.MoveVRCameraToTarget(___cam.transform); }
public static void CharaCustomStartPostfix(CustomControl ___customCtrl) { VRLog.Info("Setting VR Camera to game camera"); if (VRManager.Instance.Mode.GetType().Equals(typeof(GenericSeatedMode))) { VRPatcher.MoveVRCameraToTarget(___customCtrl.camCtrl.transform, false); } else { VRPatcher.MoveVRCameraToMainCamera(false); } }
public static void CameraControlV2(CameraControl_Ver2 __instance) { if (povEnabledValue) { return; } if (VRManager.Instance.Mode.GetType().Equals(typeof(GenericSeatedMode))) { VRPatcher.SyncToMainTransform(__instance.transform, false); } }
public void Update() { VRPatcher.handlePOVXStatus(); if (VR_ACTIVATED && Application.productName == "StudioNEOV2" && Studio.Studio.Instance.ociCamera != null) { VRPatcher.SyncToMainTransform(Studio.Studio.Instance.ociCamera.objectItem.transform, false); } else if (VR_ACTIVATED && Application.productName == "StudioNEOV2" && VRManager.Instance.Mode.GetType().Equals(typeof(GenericSeatedMode))) { if (!VRPatcher.povEnabledValue) { VRPatcher.SyncToMainTransform(Studio.Studio.Instance.cameraCtrl.transform, false); } } }
public static void ADVSceneSetCameraPostfix(ADVScene __instance, TextScenario ___scenario) { VRLog.Info("Setting VR Camera to game camera (ADV SET CAM)"); foreach (ADV.CharaData chara in ___scenario.commandController.Characters.Values) { if (chara.heroine != null) { VRLog.Info($"Adjusting towards: {chara.heroine.chaFile.parameter.fullname}"); AdjustForFOVDifference(__instance.advCamera.transform, chara.heroine.transform, TITLE_FOV, GetVRFOV(), LOBBY_DISTANCE_ADJ_RATIO); } } VRPatcher.MoveVRCameraToTarget(__instance.advCamera.transform, false); }
public static void GlobalMethodloadResetCamerayPostfix(CameraControl_Ver2 _ctrl) { ChaControl heroine = HSceneManager.Instance?.females?[0]; if (heroine != null) { VRLog.Info($"Adjusting towards: {heroine.chaFile.parameter.fullname}"); float moveDistance = AdjustForFOVDifference(_ctrl.transform, heroine.transform, TITLE_FOV, GetVRFOV(), LOBBY_DISTANCE_ADJ_RATIO, true); _ctrl.TargetPos = _ctrl.transform.InverseTransformPoint(_ctrl.transform.position); _ctrl.CameraDir = Vector3.MoveTowards(_ctrl.CameraDir, _ctrl.TargetPos, moveDistance); } VRLog.Info("Setting VR Camera to game camera"); VRPatcher.MoveVRCameraToMainCamera(); }
protected override void OnUpdate() { base.OnUpdate(); /* foreach(Valve.VR.EVRButtonId eVRButton in Enum.GetValues(typeof(Valve.VR.EVRButtonId))) * { * if (Controller.GetPressDown(eVRButton)) * { * VRLog.Info($"Button: {eVRButton.ToString()}"); * } * } */ if (Controller.GetPressDown(Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger)) { triggerStartTime = Time.unscaledTime; } if (Controller.GetPressUp(Valve.VR.EVRButtonId.k_EButton_Dashboard_Back)) { VRPatcher.POVEnabledKeypress(); } if (Controller.GetPress(Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger)) { if (VRPatcher.povEnabledValue && Time.unscaledTime - triggerStartTime > 1.5f) { Owner.StartRumble(new RumbleImpulse(800)); } } if (Controller.GetPressUp(Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger)) { if (VRPatcher.povEnabledValue && Time.unscaledTime - triggerStartTime > 1.5f) { VRPatcher.POVPaused = !VRPatcher.POVPaused; triggerStartTime = 0f; } else if (!VRPatcher.povEnabledValue) { VRPatcher.POVEnabledKeypress(); } else { VRPatcher.CharaCycleKeyPress(); triggerStartTime = 0f; } } if (Controller.GetPressUp(Valve.VR.EVRButtonId.k_EButton_SteamVR_Touchpad)) { VRPatcher.LockOnCyclePress(); } }
public static void syncPOVXCamera() { if (mPositionChangeResetPov) { mPositionChangeResetPov = false; POVPaused = !POVPaused; syncPOVXCamera(); POVPaused = !POVPaused; return; } handlePOVXStatus(); if (povEnabledValue && !POVPaused) { VRPatcher.SyncToMainTransform(Camera.main.transform, positionOnly: false, adjustHead: true); } }
public static void TitleSceneSetPositionPostfix(ref Camera ___mainCamera, Heroine ___heroine) { if (VRManager.Instance.Mode.GetType().Equals(typeof(GenericSeatedMode))) { ((GenericSeatedMode)VRManager.Instance.Mode).Recenter(); } VRLog.Info("Setting VR Camera to game camera (Title SetPOS)"); //VRPatcher.MoveVRCameraToMainCamera(); if (___heroine != null) { AdjustForFOVDifference(___mainCamera.transform, ___heroine.transform, TITLE_FOV, GetVRFOV(), TITLE_DISTANCE_ADJ_RATIO); } VRPatcher.MoveVRCameraToTarget(___mainCamera.transform); }
public static void TextScenarioRequestNextLine(TextScenario __instance, int ___currentLine) { Command command = __instance.CommandPacks[___currentLine].Command; VRLog.Info($"Executing Command Line: (CommandList Add - {command} {string.Join(",", __instance.CommandPacks[___currentLine].Args)} {__instance.advScene.advCamera.transform.position}"); if (command == Command.NullSet) { if (__instance.CommandPacks[___currentLine].Args[1].Equals("Camera")) { string camEventName = __instance.CommandPacks[___currentLine].Args[0]; GameObject camGO = GameObject.Find(camEventName); Transform camTransform = camGO == null ? __instance.advScene.advCamera.transform : camGO.transform; VRLog.Info($"Looking for GO {camEventName} Found: {camGO}"); foreach (ADV.CharaData chara in __instance.commandController.Characters.Values) { if (chara.heroine != null) { VRLog.Info($"Adjusting towards: {chara.heroine.chaFile.parameter.fullname}"); AdjustForFOVDifference(camTransform, chara.heroine.transform, TITLE_FOV, GetVRFOV(), TITLE_DISTANCE_ADJ_RATIO); } } VRLog.Info($"Setting VR Camera to game camera (CommandList Add) {camTransform}"); VRPatcher.MoveVRCameraToTarget(camTransform, false); } } else if (command == Command.CameraPositionSet) { foreach (ADV.CharaData chara in __instance.commandController.Characters.Values) { if (chara.heroine != null) { VRLog.Info($"Adjusting towards: {chara.heroine.chaFile.parameter.fullname}"); AdjustForFOVDifference(__instance.advScene.advCamera.transform, chara.heroine.transform, TITLE_FOV, GetVRFOV(), TITLE_DISTANCE_ADJ_RATIO); } } VRLog.Info($"Setting VR Camera to game camera (CommandList Add) {__instance.advScene.advCamera.transform.position}"); VRPatcher.MoveVRCameraToTarget(__instance.advScene.advCamera.transform, false); } }
public static bool EyeLookControllerLateUpdate(EyeLookController __instance) { VRPatcher.MoveMainCameraToVRCamera(__instance.target); return(true); }
public static void TitleSceneSetPositionPostfix(ref Camera ___mainCamera) { VRLog.Info("Setting VR Camera to game camera"); VRPatcher.MoveVRCameraToMainCamera(true); //VRPatcher.MoveVRCameraToTarget(___mainCamera.transform); }
public static void ImportCameraData(Studio.CameraControl __instance) { __instance.InternalUpdateCameraState(Vector3.zero, 0); VRPatcher.MoveVRCameraToTarget(__instance.transform, false); }
public static void LobbySceneManagerSetCameraAndCharaPositionPostfix() { VRLog.Info("Setting VR Camera to game camera"); VRPatcher.MoveVRCameraToMainCamera(); }
public static void GlobalMethodloadResetCamerayPostfix() { VRLog.Info("Setting VR Camera to game camera"); VRPatcher.MoveVRCameraToMainCamera(); }
public static void BaseCameraControl_Ver2ResetPostfix() { VRLog.Info("Setting VR Camera to game camera"); VRPatcher.MoveVRCameraToMainCamera(); }
public static void HomeSceneManagerSetCameraPositionPostfix() { VRLog.Info("Setting VR Camera to game camera (Home SetPOS)"); VRPatcher.MoveVRCameraToMainCamera(); }
public static bool TitleSceneLateUpdate(EyeLookController __instance) { VRLog.Info("Setting VR Camera to game camera"); VRPatcher.MoveVRCameraToMainCamera(); return(true); }
public static bool NeckLookControllerVer2LateUpdate(NeckLookControllerVer2 __instance) { VRPatcher.MoveMainCameraToVRCamera(__instance.target); return(true); }