Variable direction scrolling textures.

What i’m trying to do is to make a scrolling texture that scrolls to the direction an empty is rotated.

I’ve looked trough the scrolling texture script and i think i understand how it works, But i have no idea where to start with this.
Is there any easy way to get the rotation value of certain axis and transfer it to the direction a texture is scrolling?

Solving this by reading an angle is not advised. ‘eulerAngles’ can change representation and therefore would only work through some restricted ranges of rotation. But you can use a vector such as transform.up or transform.right. The following code uses the x and y components of transfor.right. Rotate ‘directionObject’ around the ‘z’ axis to point the direction of the scroll. If you are going to allow arbitrary rotation of the ‘directionObject’, then you want to zero out the ‘z’ component and normalize the result before applying it.

#pragma strict
var directionObject : Transform;
var speed = 0.2;

private var offset = Vector2(1,1);

function Update () {
	offset -= speed * Time.deltaTime * directionObject.right;
	renderer.material.SetTextureOffset("_MainTex", offset);