问题
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