• API
• FAQ
• Tools
• Archive
SHARE
TWEET

# Skateboard

Bcadren Apr 18th, 2015 (edited) 313 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
1. var newVertices : Vector3[];
2. var newUV : Vector2[];
3. var newTriangles : int[];
4. var triangles : Array;
5. var UVs : Array;
6. var vertices : Array;
7. var width : float;
8. var length : float;
9. var depth : float;
10. var duckHeight : float;
11. private var currentLength : int;
12.
13. function Start () {
14.         UVs = new Array ();
15.         newVertices = [Vector3(0,0,0), Vector3(0,0,width), Vector3(length,0,0), Vector3(length,0,width), Vector3(0,0,width/2),
16.
22.
23.                 Vector3(length,0,width/2),
29.
30. ];      currentLength = newVertices.Length;
31.         vertices = Array(newVertices);
32.         for (j=0; j<currentLength; j++)
34.         newVertices = vertices.ToBuiltin(Vector3);
35.         newTriangles = [0,1,3, 0,3,2, 0,9,4, 5,4,6, 6,4,7, 7,4,8, 8,4,9, 5,1,4,
36.                 2,10,15, 15,10,14, 14,10,13, 13,10,12, 12,10,11, 11,10,3 ];
37.         currentLength = (newTriangles.Length/3);
38.         triangles = Array(newTriangles);
39.         for (k=0; k< currentLength; k++){
44.                 2,15,18, 18,15,31,
45.                 15,14,31, 31,14,30,
46.                 14,13,30, 30,13,29,
47.                 13,12,28, 13,28,29,
48.                 12,11,27, 12,27,28,
49.                 11,3,19, 11,19,27,
50.                 3,1,19, 1,17,19,
51.                 1,5,21, 1,21,17,
52.                 5,6,22, 21,5,22,
53.                 6,23,22, 23,6,7,
54.                 23,7,24, 24,7,8,
55.                 8,25,24, 25,8,9,
56.                 16,25,9, 16,9,0);
57.         newTriangles = triangles.ToBuiltin(int);
58.         for (i=0; i< newVertices.length; i++)