from github

This commit is contained in:
jonas
2024-10-29 17:16:17 +01:00
commit 537f1d77fb
1074 changed files with 303521 additions and 0 deletions
+25
View File
@@ -0,0 +1,25 @@
using System.Collections;
using System.Collections.Generic;
using TMPro;
using Unity.Netcode;
using UnityEngine;
// this script moves the name tag above the head
public class NameLabel : NetworkBehaviour
{
[SerializeField] private GameObject NameCanvas;
[SerializeField] private GameObject MainCamera;
private void Update()
{
//if you are owner of the player object this script is attached to, move the name tag relative to your position
// sync handled by PlayerComponent...Sync
if (IsOwner)
{
NameCanvas.transform.position = MainCamera.transform.position + Vector3.up * 0.625f;
NameCanvas.transform.rotation = Quaternion.EulerRotation(0, Quaternion.ToEulerAngles(MainCamera.transform.rotation).y + 135, 0);
}
}
}