void maybeUpdateHeadPosition() { if (VVRConfig.AllowHeadRepositioning()) { if (Input.GetKeyDown(KeyCode.UpArrow)) { FIRST_PERSON_OFFSET += new Vector3(0f, 0f, 0.1f); } if (Input.GetKeyDown(KeyCode.DownArrow)) { FIRST_PERSON_OFFSET += new Vector3(0f, 0f, -0.1f); } if (Input.GetKeyDown(KeyCode.LeftArrow)) { FIRST_PERSON_OFFSET += new Vector3(-0.1f, 0f, 0f); } if (Input.GetKeyDown(KeyCode.RightArrow)) { FIRST_PERSON_OFFSET += new Vector3(0.1f, 0f, 0f); } if (Input.GetKeyDown(KeyCode.PageUp)) { FIRST_PERSON_OFFSET += new Vector3(0f, 0.1f, 0f); } if (Input.GetKeyDown(KeyCode.PageDown)) { FIRST_PERSON_OFFSET += new Vector3(0f, -0.1f, 0f); } VVRConfig.UpdateHeadOffset(FIRST_PERSON_OFFSET); } }
void Awake() { _prefab = VRAssetManager.GetAsset <GameObject>(PLAYER_PREFAB_NAME); _preferredHand = VVRConfig.GetPreferredHand(); FIRST_PERSON_OFFSET = VVRConfig.GetHeadOffset(); ensurePlayerInstance(); }
private static bool InitializeXRSDKLoaders(XRManagerSettings managerSettings) { LogDebug("Initializing XRSDK Loaders..."); if (managerSettings == null) { LogError("XRManagerSettings instance is null, cannot initialize loader."); return(false); } managerSettings.InitializeLoaderSync(); if (managerSettings.activeLoader == null) { LogError("XRManager.activeLoader is null! Cannot initialize VR!"); return(false); } OpenVRSettings openVrSettings = OpenVRSettings.GetSettings(false); if (openVrSettings != null) { OpenVRSettings.MirrorViewModes mirrorMode = VVRConfig.GetMirrorViewMode(); LogInfo("Mirror View Mode: " + mirrorMode); openVrSettings.SetMirrorViewMode(mirrorMode); } LogDebug("Got non-null Active Loader."); return(true); }
private void checkAndSetHandsAndPointers() { // First try and initialize both hands and pointer scripts if (_leftHand == null || _leftPointer == null) { _leftHand = getHand(LEFT_HAND, _instance); if (_leftHand != null) { _leftPointer = _leftHand.GetComponent <SteamVR_LaserPointer>(); } } if (_rightHand == null || _rightPointer == null) { _rightHand = getHand(RIGHT_HAND, _instance); if (_rightHand != null) { _rightPointer = _rightHand.GetComponent <SteamVR_LaserPointer>(); } } if (_leftHand != null) { _leftHand.enabled = VVRConfig.HandsEnabled(); } if (_rightHand != null) { _rightHand.enabled = VVRConfig.HandsEnabled(); } // Next check whether the hands are active, and enable the appropriate pointer based // on what is available and what the options set as preferred. Disable the inactive pointer(s). if (handIsActive(_leftHand, _leftPointer) && handIsActive(_rightHand, _rightPointer)) { // Both hands active, so choose preferred hand if (_preferredHand == LEFT_HAND) { setPointerActive(_leftPointer, true); setPointerActive(_rightPointer, false); } else { setPointerActive(_rightPointer, true); setPointerActive(_leftPointer, false); } } else if (handIsActive(_rightHand, _rightPointer)) { setPointerActive(_rightPointer, true); setPointerActive(_leftPointer, false); } else if (handIsActive(_leftHand, _leftPointer)) { setPointerActive(_leftPointer, true); setPointerActive(_rightPointer, false); } else { setPointerActive(_leftPointer, false); setPointerActive(_rightPointer, false); } }
public static void Prefix(Player __instance, ref Quaternion ___m_lookYaw) { if (VVRConfig.UseLookLocomotion() && VRPlayer.inFirstPerson) { float currentEyeRotationAngle = __instance.m_eye.rotation.eulerAngles.y; float difference = currentEyeRotationAngle - lastEyeRotationAngle; ___m_lookYaw *= Quaternion.Euler(0f, difference, 0f); } }
public void Awake() { LogDebug("VRGUI: Awake()"); USING_OVERLAY = VVRConfig.GetUseOverlayGui(); LogInfo("VRGUI: Using Overlay - " + USING_OVERLAY); OVERLAY_CURVATURE = VVRConfig.GetOverlayCurvature(); _inputModule = EventSystem.current.gameObject.AddComponent <VRGUI_InputModule>(); }
void UpdateAmplifyOcclusionStatus() { if (_vrCam == null || _vrCam.gameObject.GetComponent <AmplifyOcclusionEffect>() == null) { return; } var effect = _vrCam.gameObject.GetComponent <AmplifyOcclusionEffect>(); effect.SampleCount = SampleCountLevel.Medium; effect.enabled = VVRConfig.UseAmplifyOcclusion(); }
public static void Postfix(Player __instance, ref Vector3 ___m_lookDir) { if (VRPlayer.attachedToPlayer) { if (!VVRConfig.UseLookLocomotion() || !VRPlayer.inFirstPerson) { ___m_lookDir = __instance.gameObject.transform.forward; } } lastEyeRotationAngle = __instance.m_eye.rotation.eulerAngles.y; }
void Awake() { VVRConfig.InitializeConfiguration(Config); if (!VVRConfig.ModEnabled()) { LogInfo("ValheimVRMod is disabled via configuration."); enabled = false; return; } LogInfo("ValheimVR Mod Awakens!"); StartValheimVR(); }
private void checkAndSetCurvatureUpdates() { if (Input.GetKeyDown(KeyCode.Minus)) { OVERLAY_CURVATURE -= 0.01f; } if (Input.GetKeyDown(KeyCode.Equals)) { OVERLAY_CURVATURE += 0.01f; } OVERLAY_CURVATURE = Mathf.Clamp(OVERLAY_CURVATURE, 0f, 1f); VVRConfig.UpdateOverlayCurvature(OVERLAY_CURVATURE); }
private bool shouldLaserPointersBeActive() { return(VVRConfig.HandsEnabled() && (Cursor.visible || (getPlayerCharacter() != null && getPlayerCharacter().InPlaceMode()))); }