mirror of
https://github.com/nothke/quality-control.git
synced 2025-08-08 23:03:43 +00:00
Conveyor belt scrolling texture
This commit is contained in:
@@ -11,6 +11,10 @@ public class ConveyorBelt : MonoBehaviour
|
||||
|
||||
Vector3 startPosition;
|
||||
|
||||
float scrollingTextureProgress = 0;
|
||||
public float scrollingTextureSpeedMult = 1;
|
||||
public Renderer scrollingTextureRenderer;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
startPosition = rb.position;
|
||||
@@ -22,4 +26,14 @@ public class ConveyorBelt : MonoBehaviour
|
||||
Vector3 targetSpeed = speed * transform.forward;
|
||||
rb.MovePosition(rb.position + targetSpeed * Time.deltaTime);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if(scrollingTextureRenderer)
|
||||
{
|
||||
scrollingTextureProgress += Time.deltaTime * speed * scrollingTextureSpeedMult;
|
||||
scrollingTextureRenderer.material.SetTextureOffset("_MainTex",
|
||||
new Vector2(0, scrollingTextureProgress));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user