- Home /
Is it possible to rotate uv coordinates in a script?
Just looking to rotate the uv coordinates in a scrip, for when I want a tileable texture at 45 degrees or something. Ive already got a scale script using:
renderer.material.SetTextureScale("_MainTex", new Vector2(scaleX, scaleY));
is it possible to rotate the texture, or uvs?
Answer by Seth-Bergman · Jul 20, 2012 at 06:23 AM
wow .. thats a little over my head .. and in js .. im working in c# ... any other ways to do this?
I think Im having problems assigning the variable rot in c# :
rot = Quaternion.Euler (0, 0, rotation);
probably not.. but you could just copy the example exactly($$anonymous$$us the update function),save it as a javascript, and attach it to the object.. Then you just need to make a call similar to the example..
var rot = Quaternion.Euler (0, 0, Time.time * rotateSpeed);
var m = $$anonymous$$atrix4x4.TRS (Vector3.zero, rot, Vector3(1,1,1) );
renderer.material.Set$$anonymous$$atrix ("_Rotation", m);
which should be easy enough to convert to c#, I imagine..
Better yet, search the web, I'm sure there's a c# example out there
sorry I'm not more help
Your answer
Follow this Question
Related Questions
Rotate objects towards gps coordinates 0 Answers
Wrong uv coordinates in Unity? (but works fine with Blender) 1 Answer
Camera rotation around player while following. 6 Answers
rotate to specific coordinate c# 1 Answer
Rotating Textures 0 Answers