Could someone help me out with a script. I am trying to create a conveyor belt without animating the actual belt. I want to use a texture on a plane that I can adjust the scroll speed. Any advice welcome.
That link helped but it doesnt scroll the bump map.
I have a plane with a material assigned to it, the material has a base and a normal map, the base scrolls but the normal map is static.
How do you get the whole material to scroll?
I see that changing _MainTex to _BumpMap scrolls the bumpmap so how do you do both?
I sorted it, just added another ‘texturename’ variable:
using UnityEngine;
using System.Collections;
public class AnimatedUVs : MonoBehaviour
{
public int materialIndex = 0;
public Vector2 uvAnimationRate = new Vector2( 1.0f, 0.0f );
public string textureName1 = "_MainTex";
public string textureName2 = "_BumpMap"; // added this line
Vector2 uvOffset = Vector2.zero;
void LateUpdate()
{
uvOffset += ( uvAnimationRate * Time.deltaTime );
if( renderer.enabled )
{
renderer.materials[ materialIndex ].SetTextureOffset( textureName1, uvOffset );
renderer.materials[ materialIndex ].SetTextureOffset( textureName2, uvOffset ); // added this line
}
}
}
This now scrolls the diffuse and bumpmap texture