Hey guys!
I have create two triangles in a mesh.
scene and game result:
material:
the problem is the “unity logo” show incorrect in the quad, how can I do it ?
my email: kenshako@gmail.com
thank you!
here is my code:
var mat : Material;
var mesh : Mesh;
function Start() {
gameObject.AddComponent("MeshFilter");
gameObject.AddComponent("MeshRenderer");
}
function Update () {
mesh = GetComponent(MeshFilter).mesh;
mesh.Clear();
mesh.vertices = [
//Triangle 1
Vector3(0, 0, 0),
Vector3(0, 5, 0),
Vector3(5, 0, 0),
//Triangle 2
Vector3(5, 0, 0),
Vector3(0, 5, 0),
Vector3(5, 5, 0)
];
mesh.uv = [
//UV 1
Vector2(0, 0),
Vector2(0, 1),
Vector2(1, 1),
//UV 2
Vector2(0, 0),
Vector2(0, 1),
Vector2(1, 1)
];
mesh.triangles = [0,1,2,3,4,5];
mesh.normals = [
//Normal 1
Vector3(1,1,1),
Vector3(1,1,1),
Vector3(1,1,1),
//Normal 2
Vector3(1,1,1),
Vector3(1,1,1),
Vector3(1,1,1)
];
renderer.material = mat;
}