Skip to content Skip to sidebar Skip to footer

Error Setting Color

I'm new with three.js. Basically I want to make something like a chessboard. I got this: for( x=-30; x<=50;x=x+10){ for( y=-30; y<=20;y=y+10 ){ var TileG

Solution 1:

for ... in loops iterate the keys of an object so tile is actually the index not the object within the array, use a normal for loop or forEach.

for (var i = 0; i < tiles.length; i++)
  tiles[i].material.color.setHex(i % 2 ? 0xffffff : 0);

Read more about for ... in loops on MDN

Post a Comment for "Error Setting Color"