From 06010f27efd16902a502e874e84944f9d1e817e5 Mon Sep 17 00:00:00 2001 From: Pasha Bibko Date: Fri, 25 Apr 2025 09:47:22 +0100 Subject: [PATCH] Fixed portals Minor visual bugs but I cba to fix them --- Assets/Scenes/SampleScene.unity | 12 ++++++++++++ Assets/Scripts/Portals/PortalManager.cs | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/Assets/Scenes/SampleScene.unity b/Assets/Scenes/SampleScene.unity index 0a54ae2..f6db5fe 100644 --- a/Assets/Scenes/SampleScene.unity +++ b/Assets/Scenes/SampleScene.unity @@ -6158,6 +6158,10 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 4470023418895194988, guid: c41b43046138ded45bddaab8e10d4cf0, type: 3} + propertyPath: m_PortalB + value: 1 + objectReference: {fileID: 0} - target: {fileID: 4470023418895194988, guid: c41b43046138ded45bddaab8e10d4cf0, type: 3} propertyPath: m_PlayerTag value: Player @@ -12067,6 +12071,10 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 4470023418895194988, guid: c41b43046138ded45bddaab8e10d4cf0, type: 3} + propertyPath: m_PortalB + value: 1 + objectReference: {fileID: 0} - target: {fileID: 4470023418895194988, guid: c41b43046138ded45bddaab8e10d4cf0, type: 3} propertyPath: m_PlayerTag value: Player @@ -12132,6 +12140,10 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 4470023418895194988, guid: c41b43046138ded45bddaab8e10d4cf0, type: 3} + propertyPath: m_PortalB + value: 0 + objectReference: {fileID: 0} - target: {fileID: 4470023418895194988, guid: c41b43046138ded45bddaab8e10d4cf0, type: 3} propertyPath: m_PlayerTag value: Player diff --git a/Assets/Scripts/Portals/PortalManager.cs b/Assets/Scripts/Portals/PortalManager.cs index 96ae786..b333a27 100644 --- a/Assets/Scripts/Portals/PortalManager.cs +++ b/Assets/Scripts/Portals/PortalManager.cs @@ -4,6 +4,7 @@ public class PortalManager : MonoBehaviour { [Header("References")] [SerializeField] GameObject m_OtherPortal; + [SerializeField] float m_AngleDif; [Header("Set References")] [SerializeField] GameObject m_CameraPrefab; @@ -69,8 +70,7 @@ public class PortalManager : MonoBehaviour if (PlayerMovement.CanGoThroughPortals() && s_TeleportedThisFrame == true) { // Rotates the player - float rotDif = -Quaternion.Angle(transform.rotation, m_OtherManager.transform.rotation); - rotDif += 180.0f; + float rotDif = -Quaternion.Angle(transform.rotation, m_OtherManager.transform.rotation) + m_AngleDif; CameraController.Instance().RotatePlayerDirection(new Vector2(0f, rotDif)); // Tellss the player it went through a portal