Attach Camera to Player

This commit is contained in:
pelpanagiotis
2026-02-09 21:58:30 +02:00
parent 9bcb47d8f6
commit aa248cda7e
10 changed files with 222 additions and 108 deletions

View File

@@ -124,7 +124,7 @@ public class Player : NetworkBehaviour
if (nameTagPrefab != null)
{
nameTagInstance = Instantiate(nameTagPrefab, transform);
nameTagInstance.transform.localPosition = new Vector3(0f, nameTagHeight, 0f);
nameTagInstance.transform.localPosition = new Vector3(0f, 2.0f, 0f);
nameTagInstance.transform.localRotation = Quaternion.identity;
// try to find either a TextMesh or legacy TextMesh in the prefab
nameTagTextMesh = nameTagInstance.GetComponentInChildren<TextMesh>();
@@ -134,7 +134,7 @@ public class Player : NetworkBehaviour
// create a simple 3D text (TextMesh) so no extra UI package is required
nameTagInstance = new GameObject("NameTag");
nameTagInstance.transform.SetParent(transform, false);
nameTagInstance.transform.localPosition = new Vector3(0f, nameTagHeight, 0f);
nameTagInstance.transform.localPosition = new Vector3(0f, 2.0f, 0f);
nameTagTextMesh = nameTagInstance.AddComponent<TextMesh>();
nameTagTextMesh.alignment = TextAlignment.Center;