I have an object car
that contains sub-objects:
var car = {
bumper: {
nodes: [[x,y,z],[x,y,z],[...], ... ],
faces: [[0,1,2],[1,2,3],[...], ... ]
},
//more objects
//references to car parts
parts: [this.bumper, this.wheel, ... ]
};
The references to these objects are then stored in a car
member array parts
. Then when I try to access these objects via the parts
references in the next function:
var drawParts = function(car.parts)
{
for(var i = 0; i < car.parts.length; ++i)
{
drawFaces(car.parts[i].faces, car.parts[i].nodes);
}
};
the error occurs in that the expression car.parts[i]
is evaluated as undefined
.
Could somebody guide me on how to send the bumper
object arrays faces
and nodes
to the drawFaces()
function the proper way?