diff --git a/HellsingerVR/Components/VRInputManager.cs b/HellsingerVR/Components/VRInputManager.cs index 130ffa2..e2e297a 100644 --- a/HellsingerVR/Components/VRInputManager.cs +++ b/HellsingerVR/Components/VRInputManager.cs @@ -98,7 +98,7 @@ public void LateUpdate() } catch (Exception e) { - HellsingerVR._instance.Log.LogError(e.Message); + HellsingerVR._instance.Log.LogError(e.ToString()); } InputSystem.QueueEvent(ptr); @@ -221,34 +221,34 @@ private void UpdateGameInputs(InputEventPtr ptr) #region Input Converter functions private Vector2 GetMenuVector() { - SteamVR_Action_Vector2 input = SteamVR_Input.GetVector2Action("menu", "Navigate", true); + SteamVR_Action_Vector2 input = SteamVR_Input.GetVector2Action("menu", "Navigate"); return input.GetAxis(SteamVR_Input_Sources.Any); } private float GetMenuSelect() { - return SteamVR_Input.GetBooleanAction("menu", "Select", true).state ? 1.0f : 0.0f; + return SteamVR_Input.GetBooleanAction("menu", "Select").state ? 1.0f : 0.0f; } private float GetMenuBack() { - return SteamVR_Input.GetBooleanAction("menu", "Back", true).state ? 1.0f : 0.0f; + return SteamVR_Input.GetBooleanAction("menu", "Back").state ? 1.0f : 0.0f; } private float GetMenuPrevTab() { - return SteamVR_Input.GetBooleanAction("menu", "PrevTab", true).state ? 1.0f : 0.0f; + return SteamVR_Input.GetBooleanAction("menu", "PrevTab").state ? 1.0f : 0.0f; } private float GetMenuNextTab() { - return SteamVR_Input.GetBooleanAction("menu", "NextTab", true).state ? 1.0f : 0.0f; + return SteamVR_Input.GetBooleanAction("menu", "NextTab").state ? 1.0f : 0.0f; } private float GetMenuClose() { - return SteamVR_Input.GetBooleanAction("menu", "CloseMenu", true).state ? 1.0f : 0.0f; + return SteamVR_Input.GetBooleanAction("menu", "CloseMenu").state ? 1.0f : 0.0f; } @@ -257,12 +257,17 @@ private Vector2 GetMovementVector() { SteamVR_Action_Vector2 input = SteamVR_Input.GetVector2Action("game", "Movement", true); - float rotation = (AlignToHead ? - HellsingerVR.rig.head.rotation : - UseLeftHand ? - HellsingerVR.rig.leftHand.rotation : - HellsingerVR.rig.rightHand.rotation - ).eulerAngles.y; + Quaternion rotationQuat; + + if (AlignToHead) + { + rotationQuat = HellsingerVR.rig.head.rotation; + } + else + { + rotationQuat = GetHandTransform(UseLeftHand).Item2; + } + float rotation = rotationQuat.eulerAngles.y; if (HellsingerVR.rig.PlayerTransform) { @@ -277,7 +282,7 @@ private float GetLookValue() if (UseSnapTurn) { const float Deadzone = 0.25f; - float Val = SteamVR_Input.GetVector2Action("game", "Look", true).axis.x; + float Val = SteamVR_Input.GetVector2Action("game", "Look").axis.x; HasPendingSnapMove = false; @@ -292,23 +297,23 @@ private float GetLookValue() } return 0.0f; } - return SteamVR_Input.GetVector2Action("game", "Look", true).axis.x; + return SteamVR_Input.GetVector2Action("game", "Look").axis.x; } private float GetDashing() { - return SteamVR_Input.GetBooleanAction("game", "Dash", true).state ? 1.0f : 0.0f; + return SteamVR_Input.GetBooleanAction("game", "Dash").state ? 1.0f : 0.0f; } private float GetJumping() { - return SteamVR_Input.GetBooleanAction("game", "Jump", true).state ? 1.0f : 0.0f; + return SteamVR_Input.GetBooleanAction("game", "Jump").state ? 1.0f : 0.0f; } private float GetShooting() { - SteamVR_Action_Boolean fireAction = SteamVR_Input.GetBooleanAction("game", "Shoot", true); - SteamVR_Action_Boolean altFireAction = SteamVR_Input.GetBooleanAction("game", "ShootAlt", true); + SteamVR_Action_Boolean fireAction = SteamVR_Input.GetBooleanAction("game", "Shoot"); + SteamVR_Action_Boolean altFireAction = SteamVR_Input.GetBooleanAction("game", "ShootAlt"); bool Shooting = fireAction.state; @@ -341,25 +346,25 @@ private float GetShooting() private float GetUltimate() { - bool Shooting = SteamVR_Input.GetBooleanAction("game", "Shoot", true).state; - bool AltShooting = SteamVR_Input.GetBooleanAction("game", "ShootAlt", true).state; + bool Shooting = SteamVR_Input.GetBooleanAction("game", "Shoot").state; + bool AltShooting = SteamVR_Input.GetBooleanAction("game", "ShootAlt").state; return Shooting && AltShooting ? 1.0f : 0.0f; } private float GetSlaughtering() { - return SteamVR_Input.GetBooleanAction("game", "Slaughter", true).state ? 1.0f : 0.0f; + return SteamVR_Input.GetBooleanAction("game", "Slaughter").state ? 1.0f : 0.0f; } private float GetReloading() { - return SteamVR_Input.GetBooleanAction("game", "Reload", true).state ? 1.0f : 0.0f; + return SteamVR_Input.GetBooleanAction("game", "Reload").state ? 1.0f : 0.0f; } private float GetPausing() { - return SteamVR_Input.GetBooleanAction("game", "OpenMenu", true).state ? 1.0f : 0.0f; + return SteamVR_Input.GetBooleanAction("game", "OpenMenu").state ? 1.0f : 0.0f; } #endregion } diff --git a/HellsingerVR/Components/VRRig.cs b/HellsingerVR/Components/VRRig.cs index 80628df..2bb24ea 100644 --- a/HellsingerVR/Components/VRRig.cs +++ b/HellsingerVR/Components/VRRig.cs @@ -6,8 +6,6 @@ namespace HellsingerVR.Components public class VRRig : MonoBehaviour { public Transform head; - public Transform leftHand; - public Transform rightHand; public SteamVR_Camera vrCamera; public Camera camera; diff --git a/SteamVR_IL2CPP/Scripts/SteamVR_CameraMask.cs b/SteamVR_IL2CPP/Scripts/SteamVR_CameraMask.cs index 141ce6d..6284fab 100644 --- a/SteamVR_IL2CPP/Scripts/SteamVR_CameraMask.cs +++ b/SteamVR_IL2CPP/Scripts/SteamVR_CameraMask.cs @@ -68,7 +68,43 @@ public static Mesh CreateHiddenAreaMesh(HiddenAreaMesh_t src, VRTextureBounds_t { if (src.unTriangleCount == 0u) { - return null; + float uMin = (2f * bounds.uMin) - 1f; + float uMax = (2f * bounds.uMax) - 1f; + float vMin = (2f * bounds.vMin) - 1f; + float vMax = (2f * bounds.vMax) - 1f; + + Vector3[] verts = new Vector3[] { + // Left + new Vector3(-1, vMin, 0), + new Vector3(uMin, vMin, 0), + new Vector3(-1, vMax, 0), + new Vector3(uMin, vMax, 0), + // Right + new Vector3(uMax, vMin, 0), + new Vector3(1, vMin, 0), + new Vector3(uMax, vMax, 0), + new Vector3(1, vMax, 0) + }; + + int[] tris = new int[12] + { + // lower left triangle + 0, 2, 1, + // upper right triangle + 2, 3, 1, + + // lower left triangle + 4, 6, 5, + // upper right triangle + 6, 7, 5, + }; + + // Force the sides to not render + Mesh m2 = new Mesh(); + m2.vertices = verts; + m2.triangles = tris; + m2.bounds = new Bounds(Vector3.zero, new Vector3(float.MaxValue, float.MaxValue, float.MaxValue)); + return m2; } float[] array = new float[src.unTriangleCount * 3u * 2u]; Marshal.Copy(src.pVertexData, array, 0, array.Length);