setEulerFromRotationMatrix does not exist in three.js?

倖福魔咒の 提交于 2019-12-11 13:34:39

问题


I am trying to use the following to rotate my mesh on its own y axis:

// Rotate an object around an arbitrary axis in object space var rotObjectMatrix; function rotateAroundObjectAxis(object, axis, radians) { rotObjectMatrix = new THREE.Matrix4(); rotObjectMatrix.makeRotationAxis(axis.normalize(), radians); object.matrix.multiplySelf(rotObjectMatrix); // post-multiply

// new code for Three.js r50+
object.rotation.setEulerFromRotationMatrix(object.matrix);

// old code for Three.js r49 and earlier:
// object.rotation.getRotationFromMatrix(object.matrix, object.scale); }

THe problem is I am getting a "Object has no method 'setEulerFromRotationMatrix'". Has this method been deprecated? How do I get around this?


回答1:


It is easy now.

object.rotateY( radians );

There is also

object.rotateOnAxis( axis, radians );

three.js r.59



来源:https://stackoverflow.com/questions/17711914/seteulerfromrotationmatrix-does-not-exist-in-three-js

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!