Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
DacodaDragon opened this issue Jan 10, 2018 · 1 comment
Open

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

DacodaDragon opened this issue Jan 10, 2018 · 1 comment

Comments

@DacodaDragon
Copy link

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

@doztep
Copy link

doztep commented Jul 6, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants