mrdoob/three.js — Issue #1481: Object Rotation
Author: nathaliaspatricio
Created: 2012-03-09 18:06:27+00:00
State: open

I have converted a obj file in json using convert_obj_three.py inside utils folder. I'm using this in my code like that:

var loaderChair = new THREE.JSONLoader(),
callbackObj = function( geometry ) { createObject( geometry, -380, 0, 100, 0.3, 0.3, 0.3, 80, 0, 80 ) };
loaderCadeira.load( "obj/chair/chair.js", callbackObj );

My createObject function is:

function createObject( geometry, x, y, z, scaleX, scaleY, scaleZ, rotationX, rotationY, rotationZ ) {

zmesh = new THREE.Mesh( geometry, new THREE.MeshFaceMaterial() );
zmesh.position.set( x, y, z );
zmesh.scale.set( scaleX, scaleY, scaleZ );
zmesh.rotation.set(rotationX, rotationY, rotationZ);
zmesh.overdraw = true;
scene.add( zmesh );

}

My problem is the object rotation. When I put zmesh.rotation.set(0, 0, 0), the object stay "lying". It means my object is a chair and the backrest is in the floor direction. So I need to rotate that. But the rotation angles work strange. Do the angles are in degrees or in radians? It not make sense to me because I think that's only set(90, 0, 0) and my problem should be solved.

Any ideas?