Hi everybody I’am new on the forum and is my first week with Unity (6 years Shockwave 3D)
I’am trying to create a dynamic mesh a start with a simple cube
here is my code and a put the script on the main Camera
i saw nothing on the scene and no error message.
what I’am doing wrong
function makeCube () {
var size = 1500;
var VertexList = [
Vector3(-size, -size, -size),
Vector3(-size, size, -size),
Vector3( size, size, -size),
Vector3( size, -size, -size),
Vector3( size, -size, size),
Vector3( size, size, size),
Vector3(-size, size, size),
Vector3(-size, -size, size)
];
var FaceList = [
0, 1, 3, // 1: face arrière
0, 2, 3,
3, 2, 5, // 2: face droite
3, 5, 4,
5, 2, 1, // 3: face dessue
5, 1, 6,
3, 4, 7, // 4: face dessous
3, 7, 0,
0, 7, 6, // 5: face gauche
0, 6, 1,
4, 5, 6, // 6: face avant
4, 6, 7
];
var newUVs = [
Vector2(0,0), // 1: face arrière
Vector2(0,0),
Vector2(0,0), // 2: face droite
Vector2(0,0),
Vector2(0,0), // 3: face dessue
Vector2(0,0),
Vector2(0,0), // 4: face dessous
Vector2(0,0),
Vector2(0,0), // 5: face gauche
Vector2(0,0),
Vector2(0,0), // 6: face avant
Vector2(0,0)
];
var mesh = new Mesh ();
meshFilter = GetComponent(typeof(MeshFilter)) as MeshFilter;
mesh.vertices = VertexList;
//mesh.uv = newUVs;
mesh.triangles = FaceList;
mesh.RecalculateNormals();
//meshFilter.transform.position = Vector3(0, 0.5, 0);
}
if somebody a script and little explanation to do this kind of stuff to help me to understand how to do a dynamic mesh
Sorry for my poor english
cheers,
Alain