using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 3D标签
/// </summary>
public class Label3D : MonoBehaviour
{
float distanceValue;
float scaleInitial;
float scale;
void Start()
{
scaleInitial = transform.localScale.x;
}
private void Update()
{
distanceValue = Vector3.Distance(Camera.main.transform.position, transform.position) / 600;
Debug.Log($"distanceValue:{distanceValue }");
scale = scaleInitial + distanceValue;
transform.localScale = new Vector3(-scale, scale, scale);
transform.LookAt(Camera.main.transform);
}
}
3D物体标签(随镜头远近,调整自身大小)
最新推荐文章于 2023-11-22 14:53:24 发布