您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
33 行
992 B
33 行
992 B
using UnityEngine;
|
|
|
|
[RequireComponent(typeof(MeshRenderer))]
|
|
public class EnvironmentProbeVisualizer : MonoBehaviour
|
|
{
|
|
[SerializeField]
|
|
ReflectionProbe m_ReflectionProbe;
|
|
|
|
public ReflectionProbe reflectionProbe
|
|
{
|
|
get { return m_ReflectionProbe; }
|
|
set { m_ReflectionProbe = value; }
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
if (m_ReflectionProbe == null)
|
|
{
|
|
GetComponent<MeshRenderer>().enabled = false;
|
|
}
|
|
else
|
|
{
|
|
GetComponent<MeshRenderer>().enabled = true;
|
|
|
|
transform.localPosition = m_ReflectionProbe.center;
|
|
transform.localScale = m_ReflectionProbe.size;
|
|
|
|
// Unity doesn't yet support rotated reflection probes, so the visualizer
|
|
// needs to unrotate in order to display the box that will actually be used.
|
|
transform.localRotation = Quaternion.Inverse(m_ReflectionProbe.transform.rotation);
|
|
}
|
|
}
|
|
}
|