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 :))
- rotate on x object local axe (the rotation seems aligned world axe);
- rotate on y object local axe (the rotation seems aligned world axe);
- rotate on z object local axe (the rotation seems aligned world axe);
- 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
Post a Comment