using UnityEngine;
using System.Collections;
/// <summary>
/// Simple class to scroll the UVs across a model
/// </summary>
public class UVScroller : MonoBehaviour
{
[Tooltip("Speed to scroll in the X direction")]
public float xSpeed = 1.0f;//
[Tooltip("Speed to scroll in the Y direction")]
public float ySpeed = 0.0f;
private float x = 0.0f;
private float y = 0.0f;
private Material material;
void Start()
{
material = GetComponent<Renderer>().material;
}
void Update ()
{
// update our uv offset values
x = Mathf.Repeat(x + Time.deltaTime * xSpeed, 1.0f);
y = Mathf.Repeat(y + Time.deltaTime * ySpeed, 1.0f);
// set the offset on the material
material.mainTextureOffset = new Vector2(x,y);
}
}
通用物体旋转脚本
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。