本项目演示如何创建自己的顶点动画着色器。场景不使用任何纹理或动画资源,所有内容都使用Shader Graph进行着色和动画处理。
您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 
 

35 行
1.1 KiB

using UnityEngine;
using System.Collections;
using TMPro;
public class EnvMapAnimator : MonoBehaviour {
//private Vector3 TranslationSpeeds;
public Vector3 RotationSpeeds;
private TMP_Text m_textMeshPro;
private Material m_material;
void Awake()
{
//Debug.Log("Awake() on Script called.");
m_textMeshPro = GetComponent<TMP_Text>();
m_material = m_textMeshPro.fontSharedMaterial;
}
// Use this for initialization
IEnumerator Start ()
{
Matrix4x4 matrix = new Matrix4x4();
while (true)
{
//matrix.SetTRS(new Vector3 (Time.time * TranslationSpeeds.x, Time.time * TranslationSpeeds.y, Time.time * TranslationSpeeds.z), Quaternion.Euler(Time.time * RotationSpeeds.x, Time.time * RotationSpeeds.y , Time.time * RotationSpeeds.z), Vector3.one);
matrix.SetTRS(Vector3.zero, Quaternion.Euler(Time.time * RotationSpeeds.x, Time.time * RotationSpeeds.y , Time.time * RotationSpeeds.z), Vector3.one);
m_material.SetMatrix("_EnvMatrix", matrix);
yield return null;
}
}
}