im trying to great a array of vector3’s in JavaScript, im trying to create a Vertex, Edge, Face structure for a openGL cube, now im quite new to JavaScript but as HTML5 supports it, i feel JS should be a language i understand and now :),
Now I dont know how to declare a struct in JS and then how I would implement it into a array type?
I have something like this but i’m not sure if that’s correct.
var vector3 = (x=0,y=0,z=0);
but then how would I use that for a array?
Cheers for the help.
I would create an Object:
You can access the individual fields with code such as:
To place points in a vector
You could write a vector type with this too so you do not have to write
x,y, andzevery time: