javascript - threejs - How to rotate object on fixed world axis? -


function rotategearmodel(axis, value) {  	switch (axis) {  		case 'x':  			riduttore.rotation.x = parsefloat(value);  			$('#gmrotx').attr('value', parsefloat(value).tofixed(3));  			break;  		case 'y':  			riduttore.rotation.y = parsefloat(value);  			$('#gmroty').attr('value', parsefloat(value).tofixed(3));  			break;  		case 'z':  			riduttore.rotation.z = parsefloat(value);  			$('#gmrotz').attr('value', parsefloat(value).tofixed(3));  			break;  	}  }

i've experiencing trouble object rotation in threejs. have scene collada model need rotate interactively (user have 1 slider each axe, x y z). if user follows euler order there no problems, if try rotate model following steps "lost in space" experience :))

  1. rotate on x object local axe (the rotation seems aligned world axe);
  2. rotate on y object local axe (the rotation seems aligned world axe);
  3. rotate on z object local axe (the rotation seems aligned world axe);
  4. change given rotation on y axe (step 2) rotation seems not aligned world axe.

so problem simply: how can rotate object on fixed world axis step step? when rotate object on y axe 90°, x local axe horizontal become vertical, how can rotate object on world x axe (z object axe)?

now rotate model function above, axis char identifying axe of rotation , value in radians.

thank you


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -