From 610d8b832ea030301fb3618301a0400f38d9e880 Mon Sep 17 00:00:00 2001 From: Melbyj1125 <60886701+Melbyj1125@users.noreply.github.com> Date: Fri, 10 Dec 2021 18:29:51 -0600 Subject: [PATCH] Player Teleport Implemented --- .../Scripts/PlayerScripts/DebugPlayer/dPlayerMovement.cs | 9 +++++---- Assets/Scripts/PlayerScripts/PlayerMovement.cs | 5 +++++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Assets/Scripts/PlayerScripts/DebugPlayer/dPlayerMovement.cs b/Assets/Scripts/PlayerScripts/DebugPlayer/dPlayerMovement.cs index 4d6f8a7..0b73d04 100644 --- a/Assets/Scripts/PlayerScripts/DebugPlayer/dPlayerMovement.cs +++ b/Assets/Scripts/PlayerScripts/DebugPlayer/dPlayerMovement.cs @@ -166,6 +166,7 @@ public class dPlayerMovement : NetworkBehaviour g -= pStats.PlayerGrav * Time.deltaTime; rB.AddForce(new Vector3(0,g,0)); } + Respawn(); } @@ -373,7 +374,7 @@ public class dPlayerMovement : NetworkBehaviour { if (transform.position.y < -5) { - transform.position = new Vector3(1f, 3f, 1f); + TeleportPlayer(new Vector3(0,100,0)); } } @@ -575,8 +576,8 @@ public class dPlayerMovement : NetworkBehaviour moveController.enabled = true; } - - public void TeleportPlayer(){ - + public void TeleportPlayer(Vector3 position, Quaternion rotation = new Quaternion()){ + transform.position = position; + transform.rotation = rotation; } } diff --git a/Assets/Scripts/PlayerScripts/PlayerMovement.cs b/Assets/Scripts/PlayerScripts/PlayerMovement.cs index 2d0c2f7..6ab3b78 100644 --- a/Assets/Scripts/PlayerScripts/PlayerMovement.cs +++ b/Assets/Scripts/PlayerScripts/PlayerMovement.cs @@ -580,4 +580,9 @@ public class PlayerMovement : NetworkBehaviour } moveController.enabled = true; } + + public void TeleportPlayer(Vector3 position, Quaternion rotation = new Quaternion()){ + transform.position = position; + transform.rotation = rotation; + } }