mirror of
https://github.com/PashaBibko/The-Mobius-Line.git
synced 2026-04-03 17:39:03 +00:00
Started implementation of portal teleporting
This commit is contained in:
@@ -5,9 +5,9 @@ public partial class PlayerMovement : MonoBehaviour
|
||||
private void OnTriggerStay(Collider other)
|
||||
{
|
||||
// Stops it trying to find the normals of portals
|
||||
// if (other.CompareTag("Portal")) { return; }
|
||||
if (other.CompareTag("Portal")) { return; }
|
||||
|
||||
// Else adds it to the list
|
||||
// m_WallCollisions.Add(other);
|
||||
m_WallCollisions.Add(other);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,8 +57,10 @@ public class PortalManager : MonoBehaviour
|
||||
Vector3 difference = PlayerMovement.Pos() - transform.position;
|
||||
float dotProduct = Vector3.Dot(transform.up, difference);
|
||||
|
||||
Debug.Log(dotProduct + "\t" + difference);
|
||||
|
||||
// If this is true the player has crossed the portal
|
||||
if (dotProduct < 0f || true)
|
||||
if (dotProduct < 0f)
|
||||
{
|
||||
Debug.Log("Teleported player");
|
||||
|
||||
@@ -69,16 +71,11 @@ public class PortalManager : MonoBehaviour
|
||||
|
||||
// Teleports the player
|
||||
Vector3 offset = Quaternion.Euler(0f, rotDif, 0f) * difference;
|
||||
PlayerMovement.SetPos(m_OtherManager.transform.position + offset);
|
||||
PlayerMovement.SetPos(m_OtherManager.transform.position + PlayerOffset() - new Vector3(0, 2, 0));
|
||||
|
||||
// Stops the overlapping as it has ended
|
||||
m_PlayerOverlapping = false;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
Debug.Log("Player was not teleported");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user