mrdoob/three.js — Issue #731: Data values direct from an array in object positions are returned as Radians
Author: robotsuperstar
Created: 2011-11-07 09:40:24+00:00
State: open

Funky funk, mesh.rotation.y is receiving values as radians and not degree's (hence why that "Math.PI" was added)
originally the values from the array were (0,90,180,270) degrees with unexpected results, changing them to(0,1,2,3) work as used as Radians.

loader.load( { model: "tiles/tile_grass.js", callback: function( geometry ) {
for(var a = 0; a < data.length; a++) {
for(var b = 0; b < data[a].length; b++) {
//console.debug(a,b,data);
var drawTile = data[a][b];
if	(tileArray[drawTile] == 3){
var rotateTile = dataRotation[a][b];
var mesh = new THREE.Mesh( geometry, matTile);
mesh.scale.set( 10, 10, 10 );
mesh.rotation.y = tileRotArray[rotateTile] * Math.PI;
mesh.position.x = b * 160 - tileOffset;
mesh.position.z = a * 160 - tileOffset;
scene.add(mesh);
};
}
}
} } );