Portal-In-Unity icon indicating copy to clipboard operation
Portal-In-Unity copied to clipboard

Camera's do not move or rotate relative to the portal

Open DacodaDragon opened this issue 8 years ago • 1 comments

Unwanted behavior can be seen by rotating one of the portals so their rotation doesn't equal each other.

DacodaDragon avatar Jan 10 '18 14:01 DacodaDragon

After hours of investigating same issue, I found a solution here: https://answers.unity.com/questions/1118179/portals-transform-rotation-of-ported-objects.html

With following method you can rotate both portal without any problem. public void setCameraTransform() { portalCamera.transform.position = otherPortal.transform.TransformPoint(portal.transform.InverseTransformPoint(playerCamera.transform.position)); portalCamera.transform.rotation = otherPortal.transform.rotation * Quaternion.Inverse(portal.transform.rotation) * playerCamera.transform.rotation; }

with portal1 = portal, portal2 = otherPortal

doztep avatar Jul 06 '21 21:07 doztep