Weird artefact while rotating mesh uvs
I created a Unity sphere and applied standard material with albedo texture. Now I'm trying to rotate mesh uvs (it looks like this is the simpliest way to rotate the texture)
Here is the code
using UnityEngine;
public class GameController : MonoBehaviour {
public GameObject player;
public float rotationValue;
void Start () {
Mesh mesh = player.GetComponent<MeshFilter>().mesh;
Vector2[] uvs = mesh.uv;
mesh.uv = changeUvs(uvs);
}
private Vector2[] changeUvs (Vector2[] originalUvs)
{
for (int i = 0; i < originalUvs.Length; i++)
{
originalUvs[i].x = originalUvs[i].x + rotationValue;
if (originalUvs[i].x > 1)
{
originalUvs[i].x = originalUvs[i].x - 1f;
}
}
return originalUvs;
}
}
This gives me this strange artifact. What am I doing wrong?
untitled.png
(397.1 kB)
Comment
Your answer
Follow this Question
Related Questions
2 Models 1 Cracked How to make both look the same? (Material Problems) 1 Answer
Automatically assign hundred of textures to .obj file 0 Answers
Why does my model not display proper material? 2 Answers
How to add texture to a cube sphere? 0 Answers
How do you draw a sprite from an atlas on to a mesh? 1 Answer