Hello there
I would like to know if there is a way by Javascript to rotate a texture before render it to mesh (cube)? I couldn’t find anything about it in the documentation.
Greetings
Ty
Hello there
I would like to know if there is a way by Javascript to rotate a texture before render it to mesh (cube)? I couldn’t find anything about it in the documentation.
Greetings
Ty
I’m afraid that’s a no ![]()
I’ve been looking for this as well…
Take a look here:
Hello all
Tnx for your input! Im not sure if the offset is exactly what Im looking for (would like to rotate the texture), but I will play around with it. Maybe I find a solution with it as I need it.
Tnx Ty
var rotation :float = 360;
var rotationSpeed :float = 1;
function Start () {
var clip = new AnimationClip ();
clip.SetCurve ("", typeof(Material), "_Color.a", AnimationCurve.EaseInOut(0, 0, 1, 2));
var curve = AnimationCurve.Linear(0, 0, rotationSpeed, rotation);
curve.postWrapMode = WrapMode.Loop;
clip.SetCurve ("", typeof(Material), "_MainTex.rotation", curve);
// curve = AnimationCurve.Linear(0, 0, 1, 1.8);
// clip.SetCurve ("", typeof(Material), "_MainTex.offset.x", curve);
animation.AddClip (clip, clip.name);
animation.Play(clip.name);
}
@script RequireComponent(Animation)
You could always rotate the UVs for the cube in question inside a 3D modeling tool! You could also rotate the cube itself and change its controls to match, or create a rotated version of the texture inside something like Preview or MS Paint.
You can create a new rotated texture based on an existing one. It is however an expensive operation so not really something you want to do a lot of.
This thread has the details, it is in c# but can be translated to JS if you really want.
http://forum.unity3d.com/viewtopic.php?t=25405&highlight=rotate