unity 场景中图标始终面向相机
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class IconFollow : MonoBehaviour {
//Quaternion direction;
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
if(Camera.main&& Camera.main.gameObject.activeSelf)
{
transform.rotation = Camera.main.transform.rotation ;
}
}
}
Unity 图标跟随相机旋转
本文介绍了一个简单的 Unity 脚本,该脚本可以使场景中的图标始终面向相机。通过在每帧更新图标旋转来实现这一效果,确保图标总是正对相机视角。
1601

被折叠的 条评论
为什么被折叠?



