mirror of
https://github.com/PashaBibko/The-Mobius-Line.git
synced 2026-04-04 01:49:07 +00:00
iT DONTY WORK KDJMGHDFSJHFG
This commit is contained in:
@@ -8,7 +8,7 @@ public class PortalCamera : MonoBehaviour
|
||||
|
||||
// Private members //
|
||||
|
||||
PortalManager m_DisplayPortal;
|
||||
public PortalManager m_DisplayPortal;
|
||||
PortalManager m_CapturePortal;
|
||||
|
||||
RenderTexture m_RenderTexture;
|
||||
@@ -43,8 +43,9 @@ public class PortalCamera : MonoBehaviour
|
||||
// Update is called every frame
|
||||
void Update()
|
||||
{
|
||||
// Calculates the player distance from where the portal will be rendererd
|
||||
Vector3 offset = CameraController.Instance().transform.position - m_DisplayPortal.pos;
|
||||
transform.parent.position = m_CapturePortal.TranslateOffset(offset);
|
||||
Vector3 offset = m_CapturePortal.PlayerOffset();
|
||||
transform.parent.position = offset;
|
||||
|
||||
transform.parent.position = m_CapturePortal.TranslateOffsetToSpace(m_DisplayPortal.PlayerOffset(), Vector3.zero);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using System.ComponentModel;
|
||||
using UnityEngine;
|
||||
|
||||
public class PortalManager : MonoBehaviour
|
||||
@@ -9,7 +8,11 @@ public class PortalManager : MonoBehaviour
|
||||
[Header("Set References")]
|
||||
[SerializeField] GameObject m_CameraPrefab;
|
||||
[SerializeField] MeshRenderer m_PortalRenderer;
|
||||
[SerializeField] Transform m_CapturePoint;
|
||||
|
||||
[Header("Points")]
|
||||
[SerializeField] Transform m_PlayerPoint;
|
||||
[SerializeField] Transform m_Pos;
|
||||
[SerializeField] Transform m_Rot;
|
||||
|
||||
PortalManager m_OtherManager;
|
||||
PortalCamera m_PortalCamera;
|
||||
@@ -19,6 +22,10 @@ public class PortalManager : MonoBehaviour
|
||||
public Vector3 pos => transform.parent.position;
|
||||
public Quaternion rot => transform.parent.rotation;
|
||||
|
||||
public void SetPos(Vector3 v) => transform.parent.position = v;
|
||||
|
||||
public Vector3 PlayerOffset() => m_PlayerPoint.position;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
@@ -37,9 +44,18 @@ public class PortalManager : MonoBehaviour
|
||||
// Initialises the camera so it renders to the portal and not the screen
|
||||
m_PortalCamera.InitCamera(m_PortalRenderer, this);
|
||||
}
|
||||
public Vector3 TranslateOffset(Vector3 offset)
|
||||
|
||||
// Updates is called every frame
|
||||
void Update()
|
||||
{
|
||||
m_CapturePoint.localPosition = offset;
|
||||
return m_CapturePoint.position;
|
||||
m_PlayerPoint.position = CameraController.Instance().transform.position;
|
||||
}
|
||||
|
||||
public Vector3 TranslateOffsetToSpace(Vector3 pos, Vector3 euler)
|
||||
{
|
||||
m_Rot.localEulerAngles = euler;
|
||||
m_Pos.localPosition = pos;
|
||||
|
||||
return m_Pos.position;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user