Created
July 5, 2016 00:10
-
-
Save davidwallacejackson/83947b5868f83977ebbd0efc6cfa9406 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var playerToEntrance = PortalEntrance.position - PlayerCamera.transform.position; | |
| Debug.Log(playerToEntrance); | |
| var renderCenter = originalPosition - playerToEntrance; | |
| var leftEyeOffset = InputTracking.GetLocalPosition((VRNode)0); | |
| var leftEyeRotation = InputTracking.GetLocalRotation((VRNode)0); | |
| var rightEyeOffset = InputTracking.GetLocalPosition((VRNode)1); | |
| var rightEyeRotation = InputTracking.GetLocalRotation((VRNode)1); | |
| Debug.Log("left eye: " + leftEyeRotation.eulerAngles); | |
| Debug.Log("right eye: " + rightEyeRotation.eulerAngles); | |
| transform.position = renderCenter - leftEyeOffset; | |
| transform.rotation = leftEyeRotation; | |
| cameraForPortal.projectionMatrix = HMDMatrix4x4ToMatrix4x4(SteamVR.instance.hmd.GetProjectionMatrix(Valve.VR.EVREye.Eye_Left, VrEye.nearClipPlane, VrEye.farClipPlane, Valve.VR.EGraphicsAPIConvention.API_DirectX)); | |
| cameraForPortal.targetTexture = leftEyeRenderTexture; | |
| cameraForPortal.Render(); | |
| material.SetTexture("_LeftEyeTexture", leftEyeRenderTexture); | |
| transform.position = renderCenter - rightEyeOffset; | |
| transform.rotation = rightEyeRotation; | |
| cameraForPortal.projectionMatrix = HMDMatrix4x4ToMatrix4x4(SteamVR.instance.hmd.GetProjectionMatrix(Valve.VR.EVREye.Eye_Right, VrEye.nearClipPlane, VrEye.farClipPlane, Valve.VR.EGraphicsAPIConvention.API_DirectX)); | |
| cameraForPortal.targetTexture = rightEyeRenderTexture; | |
| cameraForPortal.Render(); | |
| material.SetTexture("_RightEyeTexture", rightEyeRenderTexture); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment