LethalCompany/Lethal Company/ExportedProject/Assets/Scripts/Assembly-CSharp/facePlayerOnAxis.cs

27 lines
499 B
C#
Raw Normal View History

2023-12-22 22:51:17 +00:00
using UnityEngine;
public class facePlayerOnAxis : MonoBehaviour
{
private Transform playerCamera;
public Transform turnAxis;
private bool gotPlayer;
private void Update()
{
if (!gotPlayer)
{
if (GameNetworkManager.Instance != null && GameNetworkManager.Instance.gameHasStarted)
{
playerCamera = GameNetworkManager.Instance.localPlayerController.gameplayCamera.transform;
gotPlayer = true;
}
}
else
{
base.transform.LookAt(playerCamera, turnAxis.up);
}
}
}