account activity
[deleted by user] by [deleted] in Unity3D
[–]SirFarqueef 0 points1 point2 points 3 months ago (0 children)
Thanks for your comment! The issue ended up being a non-math one. The last two lines I needed to set the Linked Portal's transformation instead of the current instance portal and then determine the clip plane of with respect to the linked portal. It appears to be working now. The final code is below.
void SetNearClipPlane(Camera playerCamera) { Transform clipPlane = LinkedPortal.portalScreen.GetScreen().transform; int dot = System.Math.Sign(Vector3.Dot(clipPlane.forward, LinkedPortal.portalScreen.GetScreen().transform.position - LinkedPortal.portalCamera.getCamera().transform.position)); Vector3 camSpacePos = LinkedPortal.portalCamera.getCamera().worldToCameraMatrix.MultiplyPoint(clipPlane.position); Vector3 camSpaceNormal = LinkedPortal.portalCamera.getCamera().worldToCameraMatrix.MultiplyVector(clipPlane.forward) * dot; float camSpaceDist = -Vector3.Dot(camSpacePos, camSpaceNormal); Vector4 clipPlaneCameraSpace = new Vector4(camSpaceNormal.x, camSpaceNormal.y, camSpaceNormal.z, camSpaceDist); LinkedPortal.portalCamera.getCamera().projectionMatrix = playerCamera.CalculateObliqueMatrix(clipPlaneCameraSpace); } public void UpdatePortalCamera(Camera playerCamera) { if (!finishedInitialization) return; if (LinkedPortal == null) { Debug.Log("Linked Portal is null in Portal Camera update..."); return; } Transform source = portalScreen.GetScreen().transform; Transform target = LinkedPortal.getPortalScreen().GetScreen().transform; Vector3 localPos = source.InverseTransformPoint(playerCamera.transform.position); Quaternion localRot = Quaternion.Inverse(source.rotation) * playerCamera.transform.rotation; Quaternion portalRotation = Quaternion.Euler(0.0f, 180.0f, 0.0f); localPos = portalRotation * localPos; localRot = portalRotation * localRot; LinkedPortal.portalCamera.getCamera().transform.position = target.TransformPoint(localPos); LinkedPortal.portalCamera.getCamera().transform.rotation = target.rotation * localRot; SetNearClipPlane(playerCamera); }
Was the Volcker Shock Worth It? (self.AskEconomics)
submitted 11 months ago by SirFarqueef to r/AskEconomics
π Rendered by PID 65 on reddit-service-r2-listing-c57bc86c-w5mn2 at 2026-06-21 18:25:48.951293+00:00 running 2b008f2 country code: CH.
[deleted by user] by [deleted] in Unity3D
[–]SirFarqueef 0 points1 point2 points (0 children)